How do I setup visual studio to register some #defines globally?

user631623 picture user631623 · Feb 24, 2011 · Viewed 47k times · Source

What I mean is, in each of my source files I have to insert #define NOGDI to stop windows.h from including GDI defines (since it's BITMAP define conflicts with mine).

e.g.

#define NOGDI
#include <windows.h>

Unfortunately, I have to do this in every seperate source file which includes windows.h, which I do not want to do. I am using Visual Studio 2005, is there any way I can set it to #define something globally? (i.e. in all of the source files).

Answer

tenfour picture tenfour · Feb 24, 2011

Project Settings -> C/C++ -> Preprocessor -> Preprocessor definitions

Here you can define symbols that are applied globally to all source code in your project.