How to "activate" the C ++ 11 standard in visual studio 2010?

I am new to C ++ programming and I need to use the Thread class in my VS 2010 project. I found this reference , but when I try the following:

#include <thread> 

VS 2010, obviously, tells me: โ€œError: I canโ€™t open the source fileโ€œ stream. โ€I understand that I need toโ€œ activate โ€C ++ 11 somehow. I donโ€™t even know where to start.

So what should I do to use () the C ++ 11 standard in visual studio 2010?

+6
source share
4 answers

std::thread is obviously not in VS 2010. I think it was added by VS 2012, which is also supported by this question and answer . Is there any specific reason why you are using 2010, and not the latest version of 2013, which supports much more of C ++ 11?

It should also be noted: contrary to GCC, MSVC does not have a โ€œwaiverโ€ of new standards. He just supports them as far as possible.

+9
source

The Visual C ++ Compiler is not fully compatible with C ++ 11. C ++ 11 features were supported with Visual Studio 2010 and added gradually. Even the next version of Visual Studio will not provide full compatibility with C ++ 11. The C ++ 11 matrix, available in different versions of Visual Studio, can be found here:

+6
source

C ++ 11 is enabled by default, but not many features are implemented in VS 2010. The C ++ 11 Standard Library skips a lot of headers in VS 2010. Here is a comparison of the last few VS versions regarding C ++ 11 support.

+2
source

Here is what I found myself.

To "activate" C ++ 11 in visual studio, you need to install the "Platform Toolset" in the project-> to v110 or higher properties. So that the visual studio understands that it must use the functions of C ++ 11.

BUT!

The Visual C ++ Compiler is not fully compatible with C ++ 11. C ++ 11 features were supported with Visual Studio 2010 and added gradually. Even the next version of Visual Studio will not provide full compatibility with C ++ 11.

Marius Bansila

So it worked for <thread> (and <future> ) in visual studio 2012.

As I believe, it is impossible to install Platform Toolset above v100 in vs2010, therefore it is impossible to "activate" C ++ 11 in vs2010.

Conclusion: to use the standard C ++ 11 features in visual studio, you will need to use the 2012 version and later, which supports Platform Toolset v110 and higher.

Correct me, please, if I am wrong!

+1
source

Source: https://habr.com/ru/post/957665/


All Articles