Ask Your Question
2

Include directory for other packages

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

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"/>
</export>

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
2

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 1,638 times

Last updated: Mar 26 '12