简体   繁体   中英

Visual Studio _MSC_VER versus Platform Toolset

I have a VS 2010 C++/CLI project that I imported into VS 2015. Because it links against some VS 2010 C++ libraries that I don't control, I need it to be compiled with the VS 2010 compiler. When I imported the project to VS 2015, I told VS not to upgrade the project (don't remember the exact options, but the project now says "Project Name (Visual Studio 2010)" in Solution Explorer). In the project properties, the Platform Toolset is listed as "Visual Studio 2010 (v100)":

Visual Studio项目属性窗口显示为平台工具集选择的Visual Studio 2010(v100)

One of the libraries I'm using has a header with some ifdefs that show an error if _MSC_VER isn't one of the supported versions (Visual C++ 6.0-10.0). That error is being generated for this project, and I've determined that the _MSC_VER showing up during build in Intellisense is 1900 (the default for VS 2015).

How do I get the project to build with the 2010 version of the C++ compiler ( _MSC_VER 1600)? Isn't that what the Platform Toolset option is supposed to control?

I misunderstood what was going on in Visual Studio. The build was actually working fine; the error being generated was coming from Intellisense. There's a known bug in Visual Studio where Intellisense doesn't properly reflect the _MSC_VER specified by the project's selected Platform Toolset. I'll leave the question up in case anyone else runs into this problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM