Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change (use older) c++ version in Visual Studio [duplicate]

Is it possible to use an older version in Visual Studio than c++11? A similar question revealed that it is not possible to use a newer version, but I want the compiler to complain when I am using language features that are only available for c++11.

like image 458
Kackao Avatar asked May 21 '15 11:05

Kackao


People also ask

How do I change my Visual Studio code to C?

After stopping the C file, go & click the File button at the top left corner of the Visual Studio Code Editor, and select the Settings via Preferences, as shown below image. After clicking the Settings, it shows the image below. In this image, select the extension button to set the settings for the C Compiler.

What is STD C ++ 17?

The /std:c++17 option enables C++17 standard-specific features and behavior. It enables the full set of C++17 features implemented by the MSVC compiler. This option disables compiler and standard library support for features that are new or changed after C++17.

Can you install 2 versions of Visual Studio?

The term side-by-side means that you can install and maintain multiple versions of a product on the same computer. For VSPackages, that means a user can have several Visual Studio versions installed on the same computer.

How do I run C++17 in VS code?

Make sure you have a C++ compiler installed before attempting to run and debug helloworld.cpp in VS Code. Open helloworld.cpp so that it is the active file. Press the play button in the top right corner of the editor. Choose C/C++: cl.exe build and debug active file from the list of detected compilers on your system.


1 Answers

To completely disable C++11 features in Visual Studio, you must compile with a toolset old enough that it does not have any C++11 features. The last version of Visual Studio to have no C++11 support was VS2008 (question about that here: Visual Studio 2008 with c++11).

To use an older toolset, you must first install that version of Visual Studio, and then modify the "Configuration Properties->General->Platform Toolset" and set it to the appropriate Visual Studio version. When you compile with Visual Studio 2008 toolset, any C++11 usage will be errors.

like image 101
MuertoExcobito Avatar answered Sep 29 '22 03:09

MuertoExcobito