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

Include directory for other packages

asked 2012-03-25 13:09:23 -0500

lgb gravatar image

I'm trying to learn how to use a package that depends on another package I have created. Both are under ros_workspace/ and one of them(first_pack) depends on the other (lib_test, which is a shared library).

I'm able to compile lib_test, and its header file is located under lib_test/include . I added <depend package="lib_test"/> in first_pack's manifest, and included the file "lib_test/mylib.h" in its executable. But when I try to compile it, it shows:

fatal error: lib_test/mylib.h: No such file or directory compilation terminated.

I tried adding: <export> <cpp cflags="-I${prefix}/include"/>

to lib_test manifest, but it still doesn't work. What is the right way to do it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-03-26 01:20:55 -0500

Stephan gravatar image

Put your header files of lib_test in the directory lib_test/include/lib_test/. This directory is automatically exported. You should be able to include "lib_test/mylib.h" then in any package that defines the <depend ...> in its manifest.

To look for missing include and linking errors, you can use

make VERBOSE=1

to see the actual compiler command with all the includes that are defined.

edit flag offensive delete link more

Question Tools



Asked: 2012-03-25 13:09:23 -0500

Seen: 2,097 times

Last updated: Mar 26 '12