ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

Can't include header files from other project

asked 2013-02-01 11:10:52 -0500

r0nald gravatar image

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.

edit retag flag offensive close merge delete

Comments

3

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.

mirzashah gravatar image mirzashah  ( 2013-02-01 12:00:35 -0500 )edit
1

Try adding project dependency in manifest.xml

ayush_dewan gravatar image ayush_dewan  ( 2013-02-01 17:52:42 -0500 )edit

When the cpp file (that needs the header from other project) is compiled, then my header's directory is not used.

r0nald gravatar image r0nald  ( 2013-02-01 22:01:45 -0500 )edit

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

mirzashah gravatar image mirzashah  ( 2013-02-05 07:56:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-02-05 08:59:28 -0500

WilliamWoodall gravatar image

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})
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2013-02-01 11:10:52 -0500

Seen: 5,035 times

Last updated: Feb 05 '13