[Interest] unresolved WinMain on porting to Qt 6

Hamish Moffatt hamish at risingsoftware.com
Fri Jun 23 07:15:32 CEST 2023


I'm porting my applications to Qt6, from 5.15. Still using qmake. My 
console applications build and run fine, but my widgets applications 
fail to link with an error (Windows, VS 2022):

1>MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external 
symbol WinMain referenced in function "int __cdecl invoke_main(void)" 
(?invoke_main@@YAHXZ)

I have a traditional entrypoint: int main(int argc, char* argv[]).


I see in Qt 5 there was a magic helper library qtmain, but this does not 
exist in Qt 6.

If I add the linker flag /ENTRY:mainCRTStartup then it builds. What's 
the correct Qt solution for this though?


Thanks

Hamish



More information about the Interest mailing list