Reputation: 145
H, i'm trying to set my project up so that i can avoid using relative paths for my header files in my project. The reason is that the project is multi-platform and I would like to avoid restructuring each use dependent on which system it's compiled on.
Currently, the header files do not use the correct path way and the only way i can use the includes is if i set relative paths to the files.
E.G.
for my file render.h i want to use:
#include "math/matrix.h" <--- this doesn't work
but
#include "../math/matrix.h" <--this works
What would i be doing incorrectly here for setting up the project?
in the Properties page, i have set up the following
VC++ Directories -> Include Directories -> C:\Game\math
C++ -> General -> Additional Include Directories -> C:\Game\math
If i right click on the .cpp files and go to properties, i have the C\C++ options but the Headers do not.
Upvotes: 1
Views: 1443
Reputation: 10049
If your file resides in C:\Game\math\matrix.h
, then an Include Directory of C:\Game\math
and #include
directive of "math/matrix.h"
, would produce a concatenated result of C:\Game\math\math/matrix.h
. You simply need to change your Include Directory to be C:\Game
(or your #include
to be only "matrix.h"
).
Also, generally you set include directories per-project, not per source (.cpp) file. The reason that the header files do not have C++ compilation options is that they are not compiled - only the sources are compiled.
Upvotes: 1