首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ubuntu中的Cilk Plus

Ubuntu中的Cilk Plus
EN

Stack Overflow用户
提问于 2015-06-26 02:54:38
回答 1查看 1.8K关注 0票数 0

我正在尝试在Ubuntu 15.04中测试以下代码。

代码语言:javascript
复制
#include <iostream>
#include <cilk/cilk.h>

using namespace std;

int main() 
{
    cilk_for(int x=0; x<10; x++) 
    {
        cout << x << endl;
    }
    return 0;
}

我得到了以下错误。似乎g++命令可以检测到cilk plus,但不知何故无法编译。

代码语言:javascript
复制
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++) 
                    ^
EN

回答 1

Stack Overflow用户

发布于 2015-06-28 11:08:17

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

代码语言:javascript
复制
g++ test_cilk.cpp -fcilkplus -lcilkrts
                   ^
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31058547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档