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

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

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


I had set up the needed define for whole project, as described, in Project Settings -> C/C++ -> Preprocessor -> Preprocessor definitions

But nevertheless this didn't work!

Eventually it turned out that problem was in checked NoInherit checkbox, "Inherit from parent or project defaults"

In defines' line of Preprocessor Definitions Dialog it's seen as: WIN32;_DEBUG;_WINDOWS;_MBCS;$(NoInherit)

Checked the thing back and the define finally recognized.


For VS2015 I edited the .vcxproj file and added a section such as this:

<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
  <ItemDefinitionGroup>
    <ClCompile>      
      <PreprocessorDefinitions>MY_VARIABLE=SOMETHING</PreprocessorDefinitions>