marian.biter - 10 months ago 58
C++ Question

# What is a path added in Additional Include Directories relative to?

What is a path added in Additional Include Directories relative to? Is it the location of the project (.vcxproj)? Is it the location of the solution (.sln)?

According to my test, the path is relative to the project directory, which is set to current during the project build. I created the project with two source files: `test.cpp` and `dir1\test2.cpp`. Both include file `test_include.h`, which is placed in the parent directory. Additional include directory is: `..\` Build log:
```         C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /I..\ /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Debug\test.pch" /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt dir1\test2.cpp test.cpp
As you can see, current directory is the project directory, and files in the command line are: `dir1\test2.cpp` and `test.cpp`, both are successfully compiled with the same `/I..\` switch.