Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

using lambda expressions

Hello ,
I'm facing the next problem :
I'm trying to build tbbs with lambda expressions on a macbook. The problem is that the os uses the g++ 4.2.1 which does not support lambda expressions. I installed the g++ 4.6v following a tutorial that showed me to rename the new version and use it as my_gcc in order to avoid conflicts. The fact is that now i can write c++ code with lambda expressions but i can't have tbbs code with lambda expressions .
Any ideas ??
0 Kudos
2 Replies
Valued Contributor II

It is not clear what version of TBB you're using. If you have a version 4.x please take a look at \Changes file for more information.

Here is some information regarding the lambda expressions from theChanges file:

- New tests were implemented, including test_lambda.cpp that checks
support for lambda expressions.

Best regards,
Black Belt
Don't lambdas just work when you use the new compiler? They're supposed to be just a fancy way to create function objects, which are TBB's bread and butter, so...

Or are you referring to the TBB test and example code? In that case, get a recent TBB source distribution, like tbb40_278oss. In build/ change the definition of CPLUS to my_gcc. You may also have to add something to CPLUS_FLAGS to get the compiler to link with the C++ runtime library like you would with normal gcc vs. g++, but maybe that tutorial has more information on that. Substitute "#define __TBB_LAMBDAS_PRESENT 1" in src/test/harness.h, examples/concurrent_priority_queue/shortpath/shortpath.cpp, and examples/task_group/sudoku/sudoku.cpp. "make all", and report back how far you got.