Cilk++ cilkexample.c = stderr 中的 200 行

标签 c stdio cilk

我在家用电脑上成功安装了 Cilk,这是一台运行 Ubuntu 的 32 位机器。据我所知,我在我的 64 位 Ubuntu 上网本上复制了这个过程,当然,除了我下载的是 64 位版本而不是 32 位版本。然而,当尝试运行下面复制的非常简单的 cilkexample.c 时,我遇到了非常非常多的错误,似乎都与它无法访问库文件有关:

In file included from /usr/include/stdio.h:28,
                 from cilkexample.c:1:
/usr/include/features.h:323:26: error: bits/predefs.h: No such file or director\
y
/usr/include/features.h:356:25: error: sys/cdefs.h: No such file or directory
/usr/include/features.h:388:23: error: gnu/stubs.h: No such file or directory
In file included from cilkexample.c:1:
/usr/include/stdio.h:36:25: error: bits/types.h: No such file or directory
/usr/include/stdio.h:161:28: error: bits/stdio_lim.h: No such file or directory
/usr/include/stdio.h:846:30: error: bits/sys_errlist.h: No such file or directo\
ry
In file included from /usr/include/stdio.h:34,
                 from cilkexample.c:1:
/usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/include/stddef.h:\
214: error: expected constructor, destructor, or type conversion before ‘typede\
f’
In file included from cilkexample.c:1:
/usr/include/stdio.h:49: error: expected constructor, destructor, or type conve\
rsion before ‘typedef’

等等,等等,等等。

这是我尝试使用命令 cilk++ -o cilkexample cilkexample.c 编译的文件:

#include <stdio.h>
#include <cilk.h>

int foo() {
    return 100;
}

int bar() {
    return 50;
}

int cilk_main(int argc, char **argv) {
    int x, y;

    x = cilk_spawn foo();
    y = cilk_spawn bar();
    cilk_sync;

    printf("Got %d %d, expecting %d %d\n", x, y, 100, 50);
    return 0;
}

同样,我认为这一定是配置问题。该代码未修改我们教授分发的工作版本,我在另一台机器上测试了该版本。

我能想到的最后一点信息是 PATH。

******@********:~/Path/To/Cilk$ echo $PATH
/usr/local/cilk/bin/:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

感谢您的帮助!

最佳答案

看起来您缺少一些标题。你说你在 Ubuntu 上,其中 header 分布在 xxx-dev 包中。

谷歌搜索你的错误中的一些 header 我发现 bits/types.h 是 Debian 上的 libc6-dev 的一部分,你应该检查你是否有至少包装。

你应该检查你的发行版文件出现在哪个包中,我现在没有可用的 Debian 或 Ubuntu 机器来检查。

编辑:我发现自己是一个 Ubuntu 盒子,看起来 libc6-dev 至少包含列出的所有文件。 dpkg-query -S [file] 给你包名

关于Cilk++ cilkexample.c = stderr 中的 200 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8439512/

相关文章:

c - 是否可以从 C 访问程序集中定义的变量?

c - printf %f 段错误

彩色终端输出不复位

linux - 如何解决 Ubuntu Linux 上的 LIBRARY_PATH Cilk 构建错误?

c - 在 Mac 上使用 gcc 静态链接 cilk 库

c++ - 为什么我在编译 cilk 程序时得到 "error expected an expression"

c - 从不兼容的指针类型 struct c 赋值

c - 这部分代码还有优化的空间吗?

c - 欧拉计划没有。 16

c - 从文件句柄获取真实路径