我正在尝试在Ubuntu 15.04中测试以下代码。
#include <iostream>
#include <cilk/cilk.h>
using namespace std;
int main()
{
cilk_for(int x=0; x<10; x++)
{
cout << x << endl;
}
return 0;
}我得到了以下错误。似乎g++命令可以检测到cilk plus,但不知何故无法编译。
anirban@anirban-XPS-8500:~$ g++ test_cilk.cpp -lcilkplus -lcilkrts
test_cilk.cpp: In function ‘int main()’:
test_cilk.cpp:8:11: error: expected primary-expression before ‘int’
cilk_for(int x=0; x<10; x++)
^
test_cilk.cpp:8:20: error: ‘x’ was not declared in this scope
cilk_for(int x=0; x<10; x++)
^发布于 2015-06-28 11:08:17
您的g++命令不正确。它应该是
g++ test_cilk.cpp -fcilkplus -lcilkrts
^https://stackoverflow.com/questions/31058547
复制相似问题