Cannot include header from another package
I have a package my_lib
, that contains Parameters.h
in he include folder, which I need to include in another package my_main
. I am following this answer to do so:
https://answers.ros.org/question/2019...
But I get
fatal error: my_lib/Parameters.h: No such file or directory compilation terminated.
when I run catkin_make
.
I can see Parameters.h
appear successfully in catkin_ws/install/include/my_lib
after I ran catkin_make install
.
In my_main package i did the following:
package.xml
: added
<build_depend>my_lib</build_depend>
<exec_depend>my_lib</exec_depend>
CMakeLists.txt
:
find_package(catkin REQUIRED COMPONENTS
...(other packages used in my_main)
my_lib )
find_package(Boost REQUIRED COMPONENTS system)
catkin_package(INCLUDE_DIRS include
LIBRARIES my_main
CATKIN_DEPENDS ...(other packages used in my_main) my_lib
DEPENDS system_lib)
include_directories( include
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} )
add_executable(my_main_node src/my_main_node.cpp)
target_link_libraries(my_main_node ${catkin_LIBRARIES} )
install(DIRECTORY
include/${PROJECT_NAME}/ DESTINATION
${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h" PATTERN
".svn" EXCLUDE )
What am I missing?
Is there a difference between "my_lib" and the
my2_lib
that appears in your CMakeLists.txt?No, that was just a typo during copying and renaming, it is all the same node. Sorry about that. Edited the post.