2010-11-21 42 views
3

我曾經是能夠編譯C程序,但現在我不能:錯誤:沒有包括在路徑搜索stdio.h中

$ cat helloworld.c 
#include <stdio.h> 

int main(void) 
{ 
    printf("Hello, world!\n"); 
    return 0; 
} 

$ gcc helloworld.c 
helloworld.c:1:19: error: no include path in which to search for stdio.h 

是的,我確實有/usr/include/stdio.h。是的,安裝了build-essentials

在我修改我的~/.bashrc以運行安裝在我的用戶目錄中的程序後,此問題開始。我知道這是什麼錯誤,因爲如果我刪除~/.bashrc,它的工作原理。

什麼環境變量將shadowing /usr/include作爲包含路徑?

+4

粘貼「.bashrc」的內容會很有幫助。 – cdhowie 2010-11-21 07:12:57

回答

3

問題是,我有另外的GCC在我的道路:

$ which gcc 
/home/joey/gcc4ti/bin/gcc 

當我試圖編譯的「Hello World」,它運行一個編譯器爲68000,而不是我的系統編譯:d

我在~/.bashrc過這樣的:

export PATH="/home/joey/gcc4ti/bin:$PATH" 

因爲路徑是爲了掃描,在/home/joey/gcc4ti/bingcc被視爲科幻RST。我將其更改爲:

export PATH="$PATH:/home/joey/gcc4ti/bin"