本文介绍了未定义对“ WinMain @ 16” collect2.exe的引用:错误:ld返回1退出状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse CDT来测试Intel指令,以下是我的程序:

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

#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

请帮助我解决该问题。

推荐答案

您的程序尚未完成。您需要实现操作系统期望的入口点。在您的情况下,它看起来像是 WinMain

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

这篇关于未定义对“ WinMain @ 16” collect2.exe的引用:错误:ld返回1退出状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-19 01:20