未定义引用`WinMain @ 16’colle2.exe:错误:ld返回1退出状态

我使用eclipse CDT测试Intel指令,下面是我的程序:

#define cpuid(func,ax,bx,cx,dx)\ __asm__ __volatile__ ("cpuid":\ "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func)); int Check_CPU_support_AES() { unsigned int a,b,c,d; cpuid(1, a,b,c,d); return (c & 0x2000000); } 

当我编译上面的代码时,我得到链接错误:

 Info: Internal Builder is used for build gcc -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\Intel.o" "..\\src\\Intel.c" gcc -o Intel.exe "src\\Intel.o" c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status 

请帮我解决这个问题。

您的计划不完整。 您需要实现OS预期的入口点。 在你的情况下,它看起来像它叫做WinMain