gpt4 book ai didi

c - undefined reference `WinMain@16' collect2.exe : error: ld returned 1 exit status

转载 作者:太空狗 更新时间:2023-10-29 15:05:58 25 4
gpt4 key购买 nike

我正在使用 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

请帮我解决这个问题。

最佳答案

您的程序未完成。您需要实现操作系统预期的入口点。在您的例子中,它看起来像是叫做 WinMain

关于c - undefined reference `WinMain@16' collect2.exe : error: ld returned 1 exit status,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16946307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com