Enabling c++11 on Visual Studio 2013

4

I got the community version of Visual Studio 2013 and I thought that c++11 was supposed to be enabled by default.

However, the macro __cplusplus has a value of 199711L (c++98) rather than 201103L (c++11). Furthermore, if I try to run c++11 specific code (likeconstexpr int a = 5;) it gives an error in the compiler. How do I enable c++11?

user2950265

Posted 2015-07-15T01:51:11.030

Reputation: 53

Answers

7

That the value of __cplusplus is still 199711L is a bug, which has been reported to Microsoft.

That shouldn't stop you from writing and compiling C++11 code. It should just work (nothing special to configure).

Beware that Visual Studio 2013's C++11 implementation is not complete. Among the unsupported features is constexpr, which explains why you're getting a compile error ;-)

misha256

Posted 2015-07-15T01:51:11.030

Reputation: 10 292

2

As of June 20, 2016, the bug reported to Microsoft has been closed and deferred. __cplusplus is still 199711L at this time. Using Visual Studio 2015 Update 2.

– tom_mai78101 – 2016-06-20T18:18:07.653