如何在visual studio 2010 Express Edition上启用C++ 11编译器?

Hel*_*llo 6 c++ tbb visual-studio-2010 visual-c++ c++11

我正在使用tbb :: parallel_for函数,它使用lambdas.我使用以下代码获得语法错误:

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);
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

语法错误:

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 ==========
Run Code Online (Sandbox Code Playgroud)

我认为这是编译器的问题.我如何获得visual studio 2010 express版的c ++ 11编译器.请建议.

chu*_*e x 3

要获得 C++11 功能,您应该使用最新版本Visual Studio 2012

来自C++11 特性(现代 C++)

Visual C++ 2010 实现了 C++0x 核心语言规范(C++11 的前身)中的许多功能,而 Visual Studio 2012 中的 Visual C++ 对此进行了扩展,包括许多 C++11 功能。