开发者

Adding an include path to the parent directory in GCC

I'm wanting to include files from the parent directory in a project I am working on. All of the header files are in the parent directory, is there any way of using -I on the commandline to search for includes in the parent directory without using an absolute path?

I know I can solve these issues using a makefile and I will probably end up doing this, but I'd like to know if there is a quick commandline trick I can use as this situation pops up a lot when I am making quick prototype code.

Currently I am trying to compile using:

g++ -Wall -I../ simple.cpp

but this seems to not work properly. Will I also need to change the includes in simple.cpp from #include include_file.hpp to #include ../inclu开发者_StackOverflowde_file.hpp ?


Hmm...

g++ -Wall -I.. simple.cpp

and

// Somewhere in simple.cpp
#include <include_file.hpp>

should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜