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)":
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.
Related
Yesterday I had to reinstall Visual Studio 2010 on a computer with both VS 2012 and VS 2013, because I needed to compile older code. The Visual Studio 2010 installation caused header file issues, as described here . I followed the details provided in the answers, and got VS 2010 to install properly.
Now, when I run the VS 2010 version of msbuild, it compiles C++ code flawlessly. All the header files are properly installed in c:\program files (x86)\Microsoft Visual Studio 10.0\VC\include .
However, when I open a project in Visual Studio 2013, and set the Platform Toolset to v100 (which is VS 2010), it can't find the header files! Although they are right there!
This was originally a VS 2013 project, and I changed the platform toolset to VS 2010. This did not change the Include Directories property of the project, which was $(VC_IncludePath).
This macro is not defined by VS 2010, so the compiler can't find the include files.
I have three doubts. Anyone there for help?
What is the "Platform Toolset" project setting in VS project
Why such setting required
What happen, if I change the setting (v110 to v100)
It is an MSBuild property that controls the specific version of the platform toolset that you want to use.
More info here: http://msdn.microsoft.com/en-us/library/windows/hardware/hh454232%28v=vs.85%29.aspx
Most likely you want to use the last stable Windows SDK. You can check the toolset that you are using looking at your Visual Studio project file (.vcxproj), looking for this XML entry:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label="Configuration">
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
<PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset>
</PropertyGroup>
Moreless it is a version of toolchain that is used to build your project. So depends on version you have selected, different compiler, linker (etc) versions are used. If you select toolset version that was released with VS2017 (v141), MSBuild will use tools from this toolset do build your project.
It is nicely described under link provided by: YoavKlein.
"The platform toolset consists of the C++ compiler (cl.exe) and linker (link.exe), along with the C/C++ standard libraries. Since Visual Studio 2015, the major version of the toolset has remained at 14, which means that projects compiled with Visual Studio 2019 or Visual Studio 2017 are ABI-backwards-compatible with projects compiled with Visual Studio 2015. The minor version has updated by 1 for each version since Visual Studio 2015:
Visual Studio 2015: v140
Visual Studio 2017: v141
Visual Studio 2019: v142"
So there is no difference in ABI if the major version is same (but in your case you ask about change from v110 to v100 so the compatibility may be broken), but it may happen that f.e. compiler provided with older version of toolset does not implement some features of the new or incomming c++ standard etc.
It is the version of all the tools used to compile and link your project.
The mapping between PlatformToolset and Visual Studio versions is as follows
Visual Studio 2012: v110
Visual Studio 2013: v120
Visual Studio 2015: v140
Visual Studio 2017: v141
Visual Studio 2019: v142
Visual Studio 2022: v143
(v130 was skipped)
Taken from
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/platform-toolset
https://learn.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=msvc-170
https://marcofoco.com/blog/2015/02/25/microsoft-visual-c-version-map/
In Visual Studio, in Solution Explorer, open the shortcut menu for your project (not for your solution) and then choose Properties to open your project Property Pages dialog box.
In the Property Pages dialog box, open the Configuration drop-down list and then select All Configurations.
In the left pane of the dialog box, expand Configuration Properties and then select General.
In the right pane, select Platform Toolset and then select the toolset you want from the drop-down list. For example, if you have installed the Visual Studio 2010 toolset, select Visual Studio 2010 (v100) to use it for your project.
Choose the OK button.
I Would refer to this link, i think it's explained better there:
https://learn.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=vs-2019
I have a VS2010 library project that I would like to use in a new app in VS2012. Of course when I open VS2012 it wants to update the library project. Is there any way of having two projects - one for VS2010 and one for VS2012?
We have a large product portfolio and not all apps will move to VS2012 at the same time.
Generally, as long as you're running VS2010 SP1, everything will work appropriately opening the project with both versions of VS.
For C++ compatibility specifically:
You can use Visual Studio 2012 to open a C++ project that was created in Visual Studio 2010 SP1. If you want to use the Visual Studio 2012 build environment to build a project that was created in Visual Studio 2010 SP1, you must have both versions of Visual Studio installed on the same computer.
The full list of compatibility information can be found on msdn
Visual Studio, as of VS2010, supports the concept of multi-targetting, where a solution can be configured for, and built with, the compiler, libraries and includes of preceding Visual Studio versions. For example, the 2010 IDE can be used to build with the v90 (2008) toolset; in 2012 IDE can be used to build with v90, v100, v110 and v110_xp toolchains, and so on.
The question is this; how to configure a CMake build system, already setup to generate solutions for Visual Studio N to build with the compiler etc of Visual Studio N, to permit building with Visual Studio N-M from within the IDE.
While toolset selection should work merely by -T toolset, the issue is that this then in turn provokes a failure in cmake-2.8/Modules/CMakeTestCXXCompiler.cmake , claiming that the cl.exe is not able to compile a simple program. This is not the case, however, in selecting a toolset within a Visual Studio version e.g. v110_xp in Visual Studio 2012. There seems to be some complication in toolsets across Visual Studio versions, as opposed to toolsets within Visual Studio versions.
Does anyone have concrete experience of CMake in this usecase, in generating solutions for toolsets from preceding versions for use in the IDE of the current version of Visual Studio?
That's covered by the CMake's command-line option -T (toolset selection), available since CMake 2.8.11. The syntax is simple:
cmake ... -T "the string VS uses to identify the toolset" ...
So, for example:
cmake ... -T v90 ...
Note that so far, this option does not have a dedicated widget in the GUI.
I have the Visual Studio 2010 installed in my system. However, my company has a different central build system and uses the compiler from Visual Studio 6. Is it possible for me to use this compiler for compiling my C++ projects in Visual Studio 2010? If yes, where to configure this?
I checked in the project settings dialog, but couldn't find any option for this. I know how to use the old compiler from the command line and I don't want to do that.
The Daffodil for Visual Studio extension (http://daffodil.codeplex.com) allows you to set any installed toolset/compiler under Project settings in VS 2010.