Shuqing Yao
Shuqing Yao

Reputation: 45

How can I undefine the System Definitions of Visual Studio 2012?

I use Visual Studio 2012 to edit source code that is targeting Linux. The problem is that syntax highlighting gets it all wrong, because it thinks _WIN32, _MSC_VER, and similar macros are defined. What can I do to get rid of them?

I tried two methods:

  1. added /u command in the property page for C++;
  2. added /U"_WIN32" /U"_MSC_VER" and so on.

but without any effect. The problem is the same in Visual Studio 2013.

What should I do?

Upvotes: 1

Views: 1235

Answers (3)

Yongwei Wu
Yongwei Wu

Reputation: 5582

These are compiler-predefined macros. You can only #undef them in the code. Use a custom header file, probably.

Anyway, the requirement seems strange to me. Why do you use MSVC if you want to scan the Linux code? If the Linux code uses any GCC extensions (it often does), it can't compile under MSVC at all.

Upvotes: 2

Shuqing Yao
Shuqing Yao

Reputation: 45

I create a test project. The definitions only affected when the code be compiled.

Upvotes: 0

Ophir Gvirtzer
Ophir Gvirtzer

Reputation: 624

You can edit them in you're project's configuration.

Right click project->properties->C/C++->preprocessor->preprocessor definitions

Upvotes: 0

Related Questions