Reputation: 2183
This would be a very weird question, but is it possible to undef _WIN32
and define __GNUC__
, in visual studio 2010/2012 settings without touching any source codes?
I added _WIN32
in "C/C++ -> Preprocessor -> Undefine Preprocessor Definitions" (which is /U"_WIN32"
), but looks like it is not honored by visual studio IDE.
The reason of doing this is to write linux/mac parts of code with the help of visual studio IDE and intellisense. Of course, this wouldn't compile, but as far as intellisense correctly parses and helps for __GNUC__
, I'm ok. I just need autocomplete and other features.
Maybe someone wants to argue why I am using visual studio for linux? Well, all vcxproj/sln are already configured for windows, and I want to take advantage of it. So.. let's not discuss about other options, such as source insight, emacs tags, etc...
Upvotes: 2
Views: 2259
Reputation: 41
I ran in to this problem as well and was able to get around the issue by doing the following in a globally included header. One was already in play for me so I didn't have to deal with including the header everywhere.
#ifdef _WIN32
#undef _WIN32
#endif
Upvotes: 4
Reputation: 62
The preprocessor macro _WIN32 is always define when using the microsoft compiler and it cannot be redefined/undefined (source: http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx)
Upvotes: 1