Cilk Plus in Ubuntu

时间:2015-06-25 18:54:38

标签: c++ ubuntu cilk-plus

I am trying to test the following code in 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; } I am getting the following error. It seems that g++ command can detect cilk plus but cannot compile somehow. 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++) ^

1 个答案:

答案 0 :(得分:1)

您的g ++命令不正确。它应该是

g++ test_cilk.cpp -fcilkplus -lcilkrts
                   ^