eclipse + cdt + mingw + windows错误“未定义的引用”WinMain @ 16“”在建 [英] eclipse + cdt + mingw + windows error "undefined reference to `WinMain@16'" on build
问题描述
C:\MinGW\bin
到我的PATH。 创建一个新的c ++项目,一个文件在其中,test.c.其中的代码:
int main(){
int i = 1;
}
尝试构建,我收到错误:
/mingw/lib/libmingw32.a(main.o):main.c :( .text + 0xd2):未定义的引用WinMain @ 16
请注意,它不是抱怨 test.c
而是一些 main.c
一个mingw的库。
我做错了什么?
好的,解决方案真的很奇怪,但我想这对于比CDT更熟练的人会比我更有意义 -
我的main()在.c文件中。当我将后缀改为.cpp时,它的作用就像一个魅力。
I installed eclipse, cdt and mingw on my windows XP machine. added C:\MinGW\bin
to my PATH.
Created a new c++ project, with one file in it, test.c. the code in it:
int main(){
int i=1;
}
Trying to build, I get the error:
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to 'WinMain@16'
Notice it's not complaining about test.c
but rather about some main.c
in one of mingw's libs.
What am I doing wrong?
well, the solution was really weird, but I guess it would make sense to someone more proficient with CDT than me - My main() was inside a .c file. When I changed the suffix to be .cpp, it worked like a charm.
这篇关于eclipse + cdt + mingw + windows错误“未定义的引用”WinMain @ 16“”在建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!