开发者

C/C++ How to access header files?

I have added some source (h开发者_运维百科eader files) in a common folder (..\shared\abc) and my code file from another folder (..\src\xyz) has #include <abc/../foo.hpp>. I get this error:

Cannot open Source file error

I can fix that by giving absolute path but that change needs to be done at many place. What should I see to fix this?

Using VC9 nmake to compile code. This is a Makefile based project.


If the included files are from some library your code is using, you'll want to specify the include path with a compiler option. For the Visual C++ compiler the command-line option to specify additional include directories is /I, e.g.:

cl /I ..\shared foo.cpp

You'll need to modify the compiler options in your Makefile accordingly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜