How to disable linking with Qt6EntryPoint in qmake ?
-
Hi,
In the scope of a migration from MFC into Qt6, I'm trying to build a project containing both MFC and Qt6 classes in QtCreator with qmake (and compiler MSVC 2019) and I would like to prevent qmake from automatically adding the Qt6EntryPoint library to the link, because the linked WinMain generates an unresolved symbol on external main.
I found the property qt_no_entry_point for the CMake build system but I cannot manage to find an equivalent for the qmake one.
The project builds successfully in MSVC2019 with relevant Qt libraries linked, Qt6EntryPoint excluded.
Many thanks.
Pierre-Olivier -
@Peyo83 said in How to disable linking with Qt6EntryPoint in qmake ?:
I found the property qt_no_entry_point for the CMake build system but I cannot manage to find an equivalent for the qmake one.
Try to add
CONFIG -= entrypoint
to your .pro file.
-
@Peyo83 said in How to disable linking with Qt6EntryPoint in qmake ?:
because the linked WinMain generates an unresolved symbol on external main
I would rather fix the main function if you're migrating to Qt6 instead of doing workarounds.
What exact error do you get? -
Qt6EntryPointd.lib(qtentrypoint_win.cpp.obj) : error LNK2019: symbole externe non r‚solu main r‚f‚renc‚ dans la fonction WinMain
debug\drvEdit.exe : fatal error LNK1120: 1 externes non r‚solusSorry it's in French, it means :
"Unresolved external symbol main referenced in function WinMain"I don't have the feeling to do workarounds, in MFC there is no apparent main method, I guess bootstrap is automatically implemented by the library which runs the unique instance of the application class deriving CWinApp.
With external build tools it is totally possible to link individual Qt library exactly as we need, I don't understand why qmake forces the link with Qt6EntryPoint(d).lib, there must be a way to prevent it (even if we need it most of the time for WINDOWS subsystem)
-
It's not linked when you create a console program
-
In console mode I have a similar error but with the runtime library:
msvcrtd.lib(exe_main.obj) : error LNK2019: symbole externe non r‚solu main r‚f‚renc‚ dans la fonction "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
Moreover, it changes the SUBSYSTEM in console, but MFC application must be built in WINDOWS subsystem.
If I remove the QT6EntryPointd.lib in the Makefile.Debug generated by qmake, it builds and runs perfectly.
So I definitely need a way to use the WINDOWS subsystem without linking with Qt6EntryPoint and Qt provides variables to make it possible with cmake... -
@Peyo83 said in How to disable linking with Qt6EntryPoint in qmake ?:
I found the property qt_no_entry_point for the CMake build system but I cannot manage to find an equivalent for the qmake one.
Try to add
CONFIG -= entrypoint
to your .pro file.
-