undefined reference to `WinMain' 解决方法
使用gcc对C代码进行编译时提示undefined reference to `WinMain',collect2.exe: error: ld returned 1 exit status;详细的信息大致如下:
省略... :crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain' collect2.exe: error: ld returned 1 exit status
解决方法
出现这种情况表示C代码中不存在入口函数,即main()
函数,请为你的C程序添加main()
函数;
int main(int argc, char* argv[]) {
}
对于刚编写的代码,请检查是否保存;