0

I try to compile a programme using cilk but it don't works

g++ -std=c++11 -fcilkplus -lcilkrts -ldl -O2 src/cpp/* -o bin/exe 

src/cpp/sous_monoide.cpp: Dans la fonction 
src/cpp/sous_monoide.cpp:269:19: erreur : expected ‘)’ before ‘;’ token
cilk_for (i = 0; i < limite; i++){
               ^
src/cpp/sous_monoide.cpp:269:36: erreur : expected ‘;’ before ‘)’ token
cilk_for (i = 0; i < limite; i++){
                                ^
src/cpp/sous_monoide.cpp:312:1: erreur : expected ‘}’ at end of input
 }
 ^
src/cpp/sous_monoide.cpp:312:1: erreur : expected ‘}’ at end of input
src/cpp/sous_monoide.cpp:312:1: erreur : expected ‘}’ at end of input

This is the code :

const int limite = n-1;
int i;
cilk_for (i = 0; i < limite; i++){
  ....
}

Thanks for your help

Picot
  • 75
  • 2
  • 10

2 Answers2

0

You need to read the documentation a bit more! If you're compiling C++ and not C, which it looks like you are, the variable for the control variable needs to be defined in the cilk_for statement. So you can't use:

int i;
cilk_for (i =.......... 

You have to use:

cilk_for (int i = 0.... 
Marat
  • 15,215
  • 2
  • 39
  • 48
The Welder
  • 916
  • 6
  • 24
0

Did you include cilk/cilk.h ?

#include <cilk/cilk.h>

cilk_for is defined in this header file. Alternatively, you can use _Cilk_for without including the header.