我在家用電腦上成功安裝了Cilk,這是一臺運行Ubuntu的32位機器。我在64位Ubuntu上網本上盡我所知複製了這個過程,當然,我下載了64位版本而不是32位版本。當試圖運行非常簡單cilkexample.c下面複製,但是,我會非常非常多的錯誤,似乎都涉及到它不能夠訪問的庫文件:Cilk ++ cilkexample.c = stderr中的200行
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
感謝您的幫助!
它看起來像你的安裝搞砸了,你錯過了很多頭文件,但不是全部,因爲你包含的stdio.h工程。 – jv42
@ jv42,我認爲你是對的,但我不知道該怎麼做。 :) –