Re: [Interest] unresolved WinMain on porting to Qt 6
On 6/26/23 08:57, Axel Spoerl via Interest wrote: 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 However, linking to QtEntryPoint should be triggered automatically, and it is for Qt's own examples. It would be interesting to know how Hamish's project looks like. Could you create a reproducer for this, please and report at bugreports.qt.io? -- Jörg Bornemann | The Qt Company ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] unresolved WinMain on porting to Qt 6
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 im Auftrag von Hamish Moffatt via Interest Gesendet: Freitag, 23. Juni 2023 07:15 An: 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
Re: [Interest] unresolved WinMain on porting to Qt 6
On 23/6/23 22:16, Henry Skoglund wrote: On 2023-06-23 07:15, Hamish Moffatt via Interest wrote: 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 :-) That wasn't it (widgets were including and linking fine), but what I figured out is that the magic helper in Qt5 qtmain is now the library Qt6EntryPoint, and for some reason that wasn't being linked. Reading the qmake debug logs, the entrypoint-private module gets added to QT_PRIVATE during processing but then vanishes before it's used. In a test application, the entrypoint-private module then adds entrypoint-implementation which links the library and all is good. I have no idea why entrypoint-private is disappearing from QT_PRIVATE, but I just added entrypoint-implementation to QT directly and I'll live with that for now. Hamish ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] unresolved WinMain on porting to Qt 6
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
[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