Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/Za compiler directive does not compile system headers in VS2010

I wanted to disable language extensions to be able to do some tests in my project. I found that I must set /Za compiler directive from http://msdn.microsoft.com/en-us/library/0k0w269d.aspx, but after this I have errors if I include windows headers. Is there a way to write standard compliant code(enforced by the compiler, not by other programmers/code reviews) in VS2010 and still use system headers?

Thanks you!

like image 748
Mircea Ispas Avatar asked Mar 30 '11 16:03

Mircea Ispas


Video Answer


2 Answers

The windows headers have never compiled with /Za.

There are other problems as well with /Za, that has caused Microsoft to stop testing their C++ standard library with that option. As told here:

http://permalink.gmane.org/gmane.comp.lib.boost.devel/212180

The recommendation is not to use it in "real" code.

like image 189
Bo Persson Avatar answered Sep 28 '22 19:09

Bo Persson


Isolate your use of <windows.h> into a source file(s) that you don't compile with /Za and use the parameter on the other files.

like image 38
Mark B Avatar answered Sep 28 '22 19:09

Mark B