On 2023-06-23 07:15, Hamish Moffatt via Interest wrote:
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?
The fact that adding /ENTRY:mainCRTStartup helped implies that you're
linking with /SUBSYSTEM:CONSOLE and not /SUBSYSTEM:WINDOWS, i.e.
defaulting to console flavor.
Maybe you forgot "QT += widgets" in the .pro file (just guessing :-)
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest