c++ - Determine when using the VC90 compiler in VS2010 instead of VS2008? -
Is there a (Microsoft-specific) CPP macro to determine that when I used the VC9 compiler in Visual Studio 2010 Resistance to Visual Studio 2008? Returns the _MSC_VER
compiler version, so with the VS2010 multi-targeting feature, I will get the same results as VS2008.
The reason for wanting to know the difference is that I have created a new VS 2010 project, which contains the code removed from the big project, I have left the VS 2008 stuff "as is" because we are anyway Are also going away from "VS 2008" and I do not want to undergo the hassle of creating vcproj with the new vcxproj .
Right now, I have defined my own macro to indicate whether or not the code has been compiled in its own DLL; It works just fine, but it would be nice if a little more elegant.
_MSC_VER
returns the compiler version
It looks like what exactly do you want (or do I have a misunderstanding?).
If the compiler is using VS2008 (also known as confusingly VC9 or cl.exe 15.0), then the _MSC_VER
will return a value that More than 1500 or greater. If compiler is used from VS2010 (also known as VC10 or cl.exe 16.0), then it will evaluate for _MSV_VER
1600.
Comments
Post a Comment