Archived

This topic is now archived and is closed to further replies.

myahmac

Help finding header files

Recommended Posts

Well if I have some files in dir/class1/foo. And another in dir/class2/foo2 what do I put in the include of foo2 to include foo. I know you can go down a directory, like if foo2 was in dir. But how does one go up then down?

Share this post


Link to post
Share on other sites
#include "../class1/foo.h"

That should do it.

Or, if you could give the absolute path (#include "/home/me/project/class1/foo.h") but that breaks as soon as the directory structure changes or you try to distribute the source.

-Auron

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You could also add the directory to the compilers list of include paths. See the manual for your IDE for further information.

Share this post


Link to post
Share on other sites