2009-01-20 114 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”导致的链接错误。

相关问题