0
$\begingroup$

Rosanswers logo

I want to create a package with just one header file and use this header file from other packages.

The header file is in HeaderProjectName/include/HeaderProjectName/HeaderFile.h

In the CMakeLists.txt "catkin_package(INCLUDE_DIRS include)" is defined and so is "install(DIRECTORY include/${PROJECT_NAME}/ ..." that was commented out in the default file.

I added the HeaderProjectName as both run and build dependency in the client's package.xml.

Still on compiling I get error that no such file as "HeaderProjectName/HeaderFile.h".

What could be wrong or what am I missing?

Using catkin on Groovy.


Originally posted by r0nald on ROS Answers with karma: 268 on 2013-02-01

Post score: 3


Original comments

Comment by mirzashah on 2013-02-01:
what your'e describing sounds correct. try this: instead of running catkin_make, go into the build folder and run make VERBOSE=1. you'll be able to see the include paths that way and get us more info.

Comment by ayush_dewan on 2013-02-01:
Try adding project dependency in manifest.xml

Comment by r0nald on 2013-02-01:
When the cpp file (that needs the header from other project) is compiled, then my header's directory is not used.

Comment by mirzashah on 2013-02-05:
could you paste the output of the compile with verbose=1 out as well as your cmakelists.txt and package.xml for both projects? i don't have enough information right now

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

In the client package you need to find_package your 'HeaderProjectName', something like this will add the includes path from HeaderProjectName:

find_package(catkin REQUIRED COMPONENTS HeaderProjectName <other packages here>)
include_directories(${catkin_INCLUDE_DIRS})

An alternative method is that you can find_package HeaderProjectName directly:

find_package(HeaderProjectName REQUIRED)
include_directories(${HeaderProjectName_INCLUDE_DIRS}) 

Originally posted by WilliamWoodall with karma: 1626 on 2013-02-05

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.