Reputation: 2619
Suppose I have a C++ project in Visual Studio 2010 in Windows 7 with the following structure:
ProjectFolder | |_FirstFolder | some_header.h | |_SecondFolder main.cpp
In order to include the some_header.h into main.cpp I have to write #include <../FirstFolder/some_header.h>
in the that source file.
It is rather cumbersome to use the UNIX directory shortcuts like .
and ..
and some standards like this one even prohibit to do this. Can I somehow live without the UNIX shortcuts? I would like to directly include files starting the navigation from the project folder like this #include <FirstFolder/some_header.h>
, but this does not seem to work.
Upvotes: 1
Views: 125
Reputation: 66
You can use
Additional Include Directories
Which can be found via Properties (of a build target) -> Configuration Properties -> C/C++.
There you can just add the relative path to FirstFolder, relative to the project root. Having done this, #include <some_header.h>
would work.
Upvotes: 2
Reputation: 70929
Try adding the home directory of your project as additional include directory(Project->Properties->C/C++->General->Additional Include Directories) I think this should work.
Upvotes: 3