Ask Your Question
3

How to include other package's headers?

asked 2012-02-09 23:02:30 -0500

sam gravatar image

updated 2012-02-10 16:10:32 -0500

I tried to create "A" and "B" package.

I added include/A/a.h on directory which "roscd A".

Then I use a.h in b.cpp and add manifest on package B:

 #include <A/a.h>

 int main()
 {
    return 0;
 }

manifest:

 <package>
   <description brief="B">

      B

   </description>
   <author>sam</author>
   <license>BSD</license>
   <review status="unreviewed" notes=""/>
   <url>http://ros.org/wiki/B</url>
   <depend package="roscpp"/>
   <depend package="A"/>

 </package>

But compile failed because of couldn't find A/a.h.

How to solve it?

Thank you~

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
9

answered 2012-02-10 00:30:23 -0500

Package A needs to export its headers. Add this to its manifest.xml file:

<export>
  <cpp cflags="-I${prefix}/include" lflags="-L${prefix}/lib"/>
</export>

For more info see the XML Reference

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

Stats

Asked: 2012-02-09 23:02:30 -0500

Seen: 2,876 times

Last updated: Feb 10 '12