2009-01-20 112 views
4

無論我嘗試在Cygwin的編譯處理,我得到以下的輸出:與「C編譯器不能創建可執行文件」的Cygwin的

 
checking for mingw32 environment... no 
checking for EMX OS/2 environment... no 
checking how to run the C preprocessor... gcc -E 
checking for gcc... gcc 
checking whether the C compiler (gcc ) works... no 
configure: error: installation or configuration problem: C compiler cannot creat 
e executables. 

日誌文件的最後幾行是這樣的:

 
configure:2810: checking for EMX OS/2 environment 
configure:2822: gcc -c conftest.c 1>&5 
configure: In function `main': 
configure:2818: error: `__EMX__' undeclared (first use in this function) 
configure:2818: error: (Each undeclared identifier is reported only once 
configure:2818: error: for each function it appears in.) 
configure: failed program was: 
#line 2815 "configure" 
#include "confdefs.h" 

int main() { 
return __EMX__; 
; return 0; } 
configure:2838: checking how to run the C preprocessor 
configure:2859: gcc -E conftest.c >/dev/null 2>conftest.out 
configure:2943: checking for gcc 
configure:3056: checking whether the C compiler (gcc ) works 
configure:3072: gcc -o conftest conftest.c -llib 1>&5 
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find 
-llib 
collect2: ld returned 1 exit status 
configure: failed program was: 

#line 3067 "configure" 
#include "confdefs.h" 

main(){return(0);} 

這是一個新的Cygwin安裝與G ++和一堆其他devtools添加。任何想法,我需要做什麼來讓這件事情起作用?

更新0:尼克,你的鏈接http://www.geektimes.com/linux/troubleshooting/c-cant-create-executables.html已經嘗試 - 不幸的是這條指令是用於redhat,似乎不適用於cygwin。

+0

你能從命令行編譯一些東西嗎?例如,一個簡單的「hello world」應用程序? – 2009-01-20 23:53:08

回答

3

您的配置有誤。 通常autoreconf -f有幫助。如果沒有,你需要檢查失敗的規則並修復它。

2

'-llib'對我來說似乎有點不同尋常,但我遠非專家。出於好奇是安裝了autoconf?我有一些類似的問題,直到我安裝了autoconf。看起來配置腳本錯誤地生成了'-llib'值,但很難說爲什麼只基於發佈的片段。

1

當我遇到這個問題時,它是由Cygwin尋找「library.o」而不是「library.obj」或「library.so」而不是「library.dll」導致的鏈接錯誤。

相關問題