[Interest] unresolved WinMain on porting to Qt 6
Axel Spoerl
axel.spoerl at qt.io
Mon Jun 26 08:57:41 CEST 2023
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-bounces at qt-project.org> im Auftrag von Hamish Moffatt via Interest <interest at qt-project.org>
Gesendet: Freitag, 23. Juni 2023 07:15
An: interest at qt-project.org <interest at 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 at qt-project.org
https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230626/37d29f86/attachment.htm>
More information about the Interest
mailing list