gpt4 book ai didi

c++ - 错误 : expected primary-expression before ‘int’

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:52:30 28 4
gpt4 key购买 nike

我正在使用:gcc --版本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++) {
^

怎么了?

谢谢

最佳答案

来自link Chris gave在评论中,GCC 4.9 似乎开箱即用地支持 cilk 扩展的所有功能 except _Cilk_for。因此,您的编译器 (GCC 4.9) 不支持 cilk_for

关于c++ - 错误 : expected primary-expression before ‘int’ ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31231900/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com