对“WinMain@16”collect2的未定义引用。exe:错误:ld返回1退出状态。

时间:2022-02-24 18:34:44

I am using eclipse CDT to test the Intel instructions and below is my program:

我使用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);
 }

When I compile the above code, I get linkage error as:

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

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

Please help me regarding the issue.

关于这个问题,请帮助我。

1 个解决方案

#1


1  

Your program isn't complete. You need to implement the OS-expected entry point. In your case, that looks like it's called WinMain.

你的程序没有完成。您需要实现os -预期的入口点。在你的例子中,这看起来像是WinMain。

#1


1  

Your program isn't complete. You need to implement the OS-expected entry point. In your case, that looks like it's called WinMain.

你的程序没有完成。您需要实现os -预期的入口点。在你的例子中,这看起来像是WinMain。