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++)
^
Your g++ command is incorrect. It should be