Include directories
- Hi. I want to add some directories into "Include File" at Tools -> Option.
Instead of having to type the full directories, can I make it relative to my .sln directory? Aside from using environment variable. Is there other method to do so, perhaps something like ./ or ../ ?
For example, instead of having "c:\work\solution\header", perhaps "../header". (Where ../ is directory for the .sln)
Anything similar to be use?
Thanks.
Ang Beepeng
All Replies
- I don't think you can use relative paths, only absolute paths and environmental variables. I think what you enter in the "Include files" field actually sets the INCLUDE environmental variable. Since that's not project specific, it probably does not use your project as a starting directory.
Hi,
Have a look at your project properties, underneath "Configuration Properties - C/C++ - General" you will see an option called "Additional Include Directories". This is what I have set in one of my projects:
"$(CG_INC_PATH)"
"$(CG_INC_PATH)/../../SDK 9.5/inc"
"$(NVSGSDKHOME)\inc\nvsg"
../libraries/cxImage600/CxImage
"$(JTTK_DEV_PATH)/include"
"$(CASROOT)\inc"
"$(SolutionDir)"
"$(CG_INC_PATH)/../../SDK 9.5/Demos/OpenGL/inc"
../libraries/cxImage600/zlib
In my header files I can just use:
// JT includes
#include <jttk/jtkxtcurve.h>
#include <jttk/jtkxtface.h>
// Opencascade includes
#include <gc_makeline.hxx>
#include <brep_curveonclosedsurface.hxx>
#include <topods_shape.hxx>// Internal includes
#include "Templates/MessageIds.h"
#include "Templates/defines.h"
#include "Templates/template_utils.h"
#include "Utils/Utils.h"
#include "IDM/IDM.h"
#include "WinUI/WinUI.h"
#include "Input/Input.h"
This is my directory structure:
+---aesthetica
| +---DCS
| +---Exporters
| +---geometry
| +---gfx
| | +---Cg
| | \---gl
| +---Importers
| +---Map Files
| +---mgrs
| +---res
| +---simulation
| +---ui
| +---util
| +---Win32
| \---WindowsUtility
+---IDM
+---Templates
+---Utils
+---WinUI
By adding "$(SolutionDir)" in the "Additional Include Directories", I can reference include files, such as "IDM/idm.h" without specifying the full absolute path. The biggest advantage is that any developer can checkout the source code project into their own folder and compile without issues due to no hardcoded paths.
Hopefully this will solve your problem, also have a look at the other available macros. As a side note I set my configuration properties to these:
Output Directory = $(SolutionDir)$(PlatformName)\$(ConfigurationName)
Intermediate Directory = $(PlatformName)\$(ConfigurationName)
This makes it easier to manage development of 32 and 64bit releases, and when you have multiple projects in the solution, all the project outputs are put into the same folder, i.e. ....\win32\release
Thanks,
Mike.- Proposed As Answer byMike Appleby Monday, November 16, 2009 9:36 PM


