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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With