How to enable C ++ 11 compiler on Visual Studio 2010 Express Edition?

I am using the tbb :: parallel_for function which uses lambdas. I get 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 a compiler problem. How to get C ++ 11 compiler for Visual Studio 2010 Express Edition. Please suggest.

+6
source share
2 answers

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

+4
source

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

From Function C ++ 11 (modern C ++) :

Visual C ++ 2010 implemented many functions in the C ++ 0x language specification, which was the predecessor of C ++ 11, and Visual C ++ in Visual Studio 2012 expands it to include many C ++ 11 functions.

+3
source

All Articles