Hi Hamish,

as you probably guessed already, the error occurs when a project built as a 
windows application uses int main(int argc, char** argv)
as an entry point. You can link to QtEntryPoint to fix that, see here: 
https://doc.qt.io/qt-6/qtentrypoint.html

Cheers
Axel
________________________________
Von: Interest <interest-boun...@qt-project.org> im Auftrag von Hamish Moffatt 
via Interest <interest@qt-project.org>
Gesendet: Freitag, 23. Juni 2023 07:15
An: interest@qt-project.org <interest@qt-project.org>
Betreff: [Interest] unresolved WinMain on porting to Qt 6

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

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to