2011-12-09 22 views
1

我在家用電腦上成功安裝了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 

感謝您的幫助!

+0

它看起來像你的安裝搞砸了,你錯過了很多頭文件,但不是全部,因爲你包含的stdio.h工程。 – jv42

+0

@ jv42,我認爲你是對的,但我不知道該怎麼做。 :) –

回答

3

看起來你缺少一些標題。你說你在Ubuntu上,其中頭文件在xxx-dev包中。

在您的錯誤中使用Google搜索的一些標題我發現bits/types.h是Debian上的libc6-dev的一部分,您應該檢查是否至少有該軟件包。

您應該檢查一下您的發行版中包含的文件,我現在沒有可用的Debian或Ubuntu機器。

編輯:我發現自己是一個Ubuntu盒子,它看起來像libc6-dev包含至少列出的所有文件。 dpkg-query -S [file]給你包名

+0

感謝您的回覆!但是,'dpkg-query -S bits/types.h'返回'libc6-dev:/ usr/include/x86_64-linux-gnu/bits/types.h'。此外,對'sudo apt-get install libc6-dev'的響應是libc6-dev處於最新版本。這似乎消除了這種可能性?現在我已經使用這臺機器幾個月來進行常規的C和C++開發。 –

+0

在這種情況下,我會嘗試強制重新安裝該軟件包 –