3

私が使用している: gcc --version gcc (Ubuntu 4.9.2-0ubuntu1~14.04) 4.9.2

次のプログラムをコンパイルしようとしています。

#include <iostream>
#include <cilk/cilk.h>

using namespace std;

int main(){

    cout << "\nStart\n";
    cilk_for (int i = 0; i < 10; i++) {
        cout << "I = " << i;
    }

}

しかし、次のエラーが発生します。

g++ -fcilkplus Cilk_1.cpp 
Cilk_1.cpp: In function ‘int main()’:
Cilk_1.cpp:9:12: error: expected primary-expression before ‘int’
  cilk_for (int i = 0; i < 10; i++) {
            ^
Cilk_1.cpp:9:23: error: ‘i’ was not declared in this scope
  cilk_for (int i = 0; i < 10; i++) {
                       ^

なにが問題ですか ?

ありがとう

4

2 に答える 2

1

前述のように、cilk_for のサポートは gcc 5.0 で追加されました。

于 2015-07-08T11:47:10.227 に答える