我在我的家用电脑上成功安装了 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
谢谢你的帮助!