Problem with converting rosmake package to catkin package
replace the old CMakeList files with new files, update the layout(thank you dornhege), add the layout with tree command
I'm currently working with a project with two rosmake package.
Both package contains several .cpp files and .h files but there are no main function in any those cpp files, and none of this file have ros functions like ros::initial() blah blah, so they are just ordinary cpp files.
I successfully convert the first package into a catkin package(follow http://wiki.ros.org/catkin/migrating_... and the catkin 0.6.15 document) then I run the catkin_make
at my work space. Everything works well, I got a lot of .cpp.o files and a libmathlib.so
(mathlib is the name of this package) file.
And in the second package, I want to use the first package. But here comes the problem, I convert the menifest.xml and CMakeList.txt into catkin format file, but as I catkin_make this package
This problem shows up
In file included from /home/lc/ros_ws/src/SEDS/src/GMR.cpp:31:0:
/home/lc/ros_ws/src/SEDS/include/GMR.h:28:28: fatal error: mathlib/Mathlib.h: No such file or directory
#include<mathlib/Mathlib.h>
Thank you for your reading, and does any one know how to solve this problem? If there are any extra information needed for this problem, please tell me.
CmakeLists: mathlib:
cmake_minimum_required(VERSION 2.8.3)
project(mathlib)
find_package(catkin REQUIRED COMPONENTS roscpp)
include_directories(include ${catkin_INCLUDE_DIRS})
catkin_package(CATKIN_DEPENDS roscpp
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME})
set(THE_SOURCE_FILES
src/Differentiator.cpp
src/GradientDescent.cpp
src/IKGroupSolver.cpp
src/IKSubSolver.cpp
src/Macros.cpp
src/MathLibCommon.cpp
src/MathLib.cpp
src/Matrix3.cpp
src/Matrix4.cpp
src/Matrix.cpp
src/ReferenceFrame.cpp
src/Regression.cpp
src/SpatialForce.cpp
src/SpatialFrame.cpp
src/SpatialInertia.cpp
src/SpatialMatrix.cpp
src/SpatialVector.cpp
src/SpatialVelocity.cpp
src/TMatrix.cpp
src/TVector.cpp
src/Vector3.cpp
src/Vector.cpp
)
add_library(${PROJECT_NAME} ${THE_SOURCE_FILES} )
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_gencpp)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")
Another package(seds):
cmake_minimum_required(VERSION 2.8.3)
project(seds)
find_package(catkin REQUIRED COMPONENTS roscpp mathlib)
include_directories(include ${catkin_INCLUDE_DIRS})
catkin_package(CATKIN_DEPENDS mathlib
DEPENDS roscpp
INCLUDE_DIRS include
LIBRARIES seds
)
set(THE_SOURCE_FILES
src/GMR.cpp
)
add_library(seds ${THE_SOURCE_FILES})
target_link_libraries(seds ${catkin_LIBRARIES})
install(TARGETS seds
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})
Layout of mine two packages mathlib package
.
├── CMakeLists.txt
├── include
│ └── mathlib
│ ├── Differentiator.h
│ ├── GradientDescent.h
│ ├── IKGroupSolver.h
│ ├── IKSubSolver.h
│ ├── Macros.h
│ ├── MathLibCommon.h
│ ├── MathLib.h
│ ├── Matrix3.h
│ ├── Matrix4.h
│ ├── Matrix.h
│ ├── ReferenceFrame.h
│ ├── Regression.h
│ ├── SpatialForce.h
│ ├── SpatialFrame.h
│ ├── SpatialInertia.h
│ ├── SpatialMatrix.h
│ ├── SpatialVector.h
│ ├── SpatialVelocity.h
│ ├── TMatrix.h
│ ├── tmp.txt
│ ├── TVector.h
│ ├── Vector3.h
│ └── Vector.h
├── package.xml
└── src
├── Differentiator.cpp
├── GradientDescent.cpp
├── IKGroupSolver.cpp
├── IKSubSolver.cpp
├── Macros.cpp
├── MathLibCommon.cpp
├── MathLib.cpp
├── Matrix3.cpp
├── Matrix4.cpp
├── Matrix.cpp
├── ReferenceFrame.cpp
├── Regression.cpp
├── SpatialForce.cpp
├── SpatialFrame.cpp
├── SpatialInertia.cpp
├── SpatialMatrix.cpp ...
Please add the file layout of the packages and the CMakeLists.txt of both packages.
Thank you for your remind I have added those information.
You can use the
tree
command to give the actual folder layout. Also remove the header files from cmake, they don't need to be compiled (explicitly) and just clutter up the files.Hi, I have done those changes recommended.
I can't see anything wrong right now. Does it work? Have you tried a clean build, i.e., remove build/ devel/?
:(. I remove the build/ and devel/ but unfortunate nothing changed, I still got the same error message. I check the devel/ folder there are no header file from mathlib generated there, I think this is the reason why seds can't find the .h file. Anyway thank you for your help:)