简体   繁体   English

确定何时在VS2010中而不是VS2008中使用VC90编译器?

[英]Determine when using the VC90 compiler in VS2010 instead of VS2008?

Is there a (Microsoft-specific) CPP macro to determine when I'm using the VC9 compiler in Visual Studio 2010 as opposed to Visual Studio 2008? 是否有一个(特定于Microsoft的)CPP宏来确定我何时在Visual Studio 2010中使用VC9编译器而不是Visual Studio 2008? _MSC_VER returns the compiler version, so with VS2010 multi-targeting feature, I'll get the same result as with VS2008. _MSC_VER返回编译器版本,因此使用VS2010多目标功能,我将获得与VS2008相同的结果。

The reason for wanting to know the difference is that I created a new VS2010 project which contains code removed from a larger project. 想要知道差异的原因是我创建了一个新的VS2010项目,其中包含从较大项目中删除的代码。 I just left the VS2008 stuff "as is" since we're moving away from VS2008 "soon" anyway and I didn't want to go through the hassle of creating a vcproj file along with the new vcxproj . 我只是“原样”离开了VS2008的东西,因为无论如何我们都将很快离开VS2008,并且我不想经历创建vcproj文件和新的vcxproj的麻烦

For now, I've just defined my own macro to indicate whether the code is compiled into its own DLL or not; 现在,我只是定义了自己的宏以指示代码是否已编译到其自己的DLL中。 it works just fine, but it would be nice if there were something slightly more elegant. 它工作得很好,但是如果有一些更优雅的东西,那就太好了。

_MSC_VER returns the compiler version _MSC_VER返回编译器版本

It sounds like that's what you really do want (or am I misunderstanding?). 听起来这就是您真正想要的(或者我误会了吗?)。

If the compiler from VS2008 (which confusingly is also known as VC9 or cl.exe 15.0) is being used, then _MSC_VER will return a value that's greater than or equal to 1500. If the compiler from VS2010 is used (also known as VC10 or cl.exe 16.0), then _MSV_VER will evaluate to 1600. 如果使用的是VS2008的编译器(令人困惑的也称为VC9或cl.exe 15.0),则_MSC_VER将返回一个大于或等于1500的值。如果使用了VS2010的编译器(也称为VC10或cl.exe 16.0),则_MSV_VER值为1600。

似乎没有解决方案,即使自定义宏不是我想要的那么优雅,它也可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以仅使用Server 2008 Platform SDK和VS2010,而使用VS2008的C ++编译器进行编译? - Can I compile using VS2008's C++ compiler using VS2010 and only the Server 2008 Platform SDK? VS2010和VS2008中C ++应用程序的性能 - Performance of C++ applications in VS2010 and VS2008 从VS2008迁移到VS2010时要记住的事项 - Things to keep in mind when migrating from VS2008 to VS2010 VS2005,VS2008下的C ++ EXE速度; VS2010编译器 - Resulting EXE speed for C++ under VS2005, VS2008; VS2010 compilers 在Windows 7上构建的C ++应用程序(使用VS2010 IDE和VS2008工具集)在Windows 7上运行,但在Win XP上不运行 - C++ app built on Windows 7 (using VS2010 IDE and VS2008 toolset) runs on Windows 7, but not on Win XP 使用托管和非托管 C++ 将 VS2008 升级到 VS2010 的问题 - Problems upgrading VS2008 to VS2010 with Managed and Unmanaged C++ 错误:C2065:'DBL_MAX':未声明的标识符(在VS2008中但不在VS2010中) - error: C2065: 'DBL_MAX' : undeclared identifier (in VS2008 but not in VS2010) 从VS2008转换为VS2010后,C ++ / CLI DLL项目停止链接 - C++/CLI DLL project stops linking after conversion from VS2008 to VS2010 将VS2008转换为VS2010项目“找不到指定的文件” - Converting VS2008 to VS2010 project “cannot find the file specified” VS2010编译器定义 - VS2010 Compiler define
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM