Is there a pragma directive for include directories?

Christoph Meißner picture Christoph Meißner · Aug 15, 2011 · Viewed 11.7k times · Source

As the title says: Is there a pragma directive for include directories using VS20** C++? I think about something like:

#pragma comment(include, "..\externals\blah\includes\")

So that I can use includes in this style, and blah.h also can use this style inside?

#include <blah.h>

I know that I can set include directories in my project settings, but I am asking for a preprocessor directive, because else i would have to set it for every compiler profile.

Regards Nem

Answer

FreeRideX picture FreeRideX · Jul 23, 2013

you can create a txt file (ex. IncludeDirs.txt). Inside that file you can add the include folders:

/I "."
/I ".."
/I ".\OtherFolder"

then in the properties->configuration properties->C/C++-> Command line add the following string:

@includedirs.txt

You can create a different file for each profile (Debug, Release, etc.)