在 Fedora 中使用 mingw-w64 时,将其编译为动态库时遇到问题:
#include <windows.h>
extern int main(int argc, char* argv[]);
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT)
{
return main(__argc, __argv);
}
我得到的链接错误是:
/usr/i686-w64-mingw32/sys-root/mingw/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):(.text.startup+0x17)||undefined reference to `__mingw_winmain_nShowCmd'|
/usr/i686-w64-mingw32/sys-root/mingw/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):(.text.startup+0x28)||undefined reference to `__mingw_winmain_lpCmdLine'|
/usr/i686-w64-mingw32/sys-root/mingw/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):(.text.startup+0x31)||undefined reference to `__mingw_winmain_hInstance'|
||=== Build finished: 3 errors, 0 warnings ===|