开发者

C/C++ How to access header files?

开发者 https://www.devze.com 2023-03-10 16:50 出处:网络
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:

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

精彩评论

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