add library to new package
im working on mpu6050 package, i have a library which is work well outside ROS, but i have a problem to make the package, i wrote a node and i added the headers an and the cpp files to include directory in my package , when i do catkin_make, the node can't see the headers , thats what i got:
/home/ahmed/catkin_ws/src/mpu6050/src/mpu6050_node.cpp:12:21: fatal error: mpu6050.h: No such file or directory
compilation terminated.
mpu6050/CMakeFiles/mpu6050_node.dir/build.make:62: recipe for target 'mpu6050/CMakeFiles/mpu6050_node.dir/src/mpu6050_node.cpp.o' failed
make[2]: *** [mpu6050/CMakeFiles/mpu6050_node.dir/src/mpu6050_node.cpp.o] Error 1
CMakeFiles/Makefile2:379: recipe for target 'mpu6050/CMakeFiles/mpu6050_node.dir/all' failed
make[1]: *** [mpu6050/CMakeFiles/mpu6050_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
i did changes to my CMakeList.txt as questions before me but nothing happened
any ideas ?? thank u in advance.
CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(mpu6050)
find_package(catkin REQUIRED COMPONENTS rosconsole roscpp rospy sensor_msgs std_msgs)
catkin_package( INCLUDE_DIRS include LIBRARIES mpu6050 CATKIN_DEPENDS rosconsole roscpp rospy sensor_msgs std_msgs )
include_directories(include ${catkin_INCLUDE_DIRS} src/mpu6050/include/mpu6050 )
add_library(mpu6050 include/${PROJECT_NAME}/mpu6050.cpp include/${PROJECT_NAME}/I2Cdev.cpp )
add_executable(mpu6050_node src/mpu6050/src/mpu6050_node.cpp )
add_dependencies(mpu6050_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(mpu6050_node ${catkin_LIBRARIES} )
install(TARGETS mpu6050 mpu6050_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
)
maybe post your
CMakeLists
then?Don't post edits as answers. There is an edit button below you question. Use the formatted text button for code (the one with 1s and 0s).
Can you link to github or whatever hoster? This would make live easier.
Otherwise: Post the line where you include the file, as well as the layout of your package (which file is where). Where is the
mpu6050.h
located?Please edit your question
i'll link it. mpu6050.h is in include directory
here the CMakeList https://github.com/AhmedElsayedHamoud...