How to enable C++11 compiler on visual studio 2010 express edition?

27,302

Solution 1

Visual C++ 2010 Express does contain C++11 features, but not all of them. Here is a list of what features it supports (as well as VC++ 2012): http://msdn.microsoft.com/en-ca/library/vstudio/hh567368.aspx

Solution 2

To get C++11 features you should use the latest version, Visual Studio 2012.

From C++11 Features (Modern C++):

Visual C++ 2010 implemented many features in the C++0x core language specification, which was the precursor to C++11, and Visual C++ in Visual Studio 2012 expands on that to include many C++11 features.

Share:
27,302
Sumanth
Author by

Sumanth

Updated on July 09, 2022

Comments

  • Sumanth
    Sumanth almost 2 years

    I am using tbb::parallel_for function which make use of lambdas. I am getting syntax errors with the following code:

    void parallel_relax( Class object, std::vector<Vertex *> verList ) {
        tbb::parallel_for (blocked_range<int>(0, verList.size()), [=](const blocked_range<Vertex *>& r) {
            for(Vertex *vit = r.begin(); vit != r.end(); ++vit) {
                Vertex *v = vit;
                object.function(v);
            }
        });
    }
    

    Syntax Errors:

    syntax error : '['
    1>main.cpp(16): error C2143: syntax error : missing ')' before '{'
    1>main.cpp(16): error C2143: syntax error : missing ';' before '{'
    1>main.cpp(17): error C2065: 'r' : undeclared identifier
    1>main.cpp(17): error C2228: left of '.begin' must have class/struct/union
    1>          type is ''unknown-type''
    1>main.cpp(17): error C2065: 'r' : undeclared identifier
    1>main.cpp(17): error C2228: left of '.end' must have class/struct/union
    1>          type is ''unknown-type''
    1>main.cpp(20): error C2059: syntax error : ')'
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    

    I think this is the problem with the compiler. How do i get c++11 compiler for visual studio 2010 express edition. Please suggest.