本文记录在Win10系统中使用mingw64对并行库Intel TBB进行编译和使用的步骤。本文时间为2020年3月12日,以上各个软件的版本均为当前较新版本。
以下环境变量及相关作用由TBB编译后生成的文件夹中的 tbbvars.bat 里的内容猜想及测试而来。 (文件夹 D:\Program Files\tbb-tbb_2020\build\windows_intel64_gcc_mingw8.1.0_release)
#include <tbb/tbb.h> #include <iostream> using namespace std; using namespace tbb; int main() { parallel_for(0, 10, [](int num) {cout << num << ":hello tbb " << endl; }); getchar(); return 0; }