Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. How to disable linking with Qt6EntryPoint in qmake ?

How to disable linking with Qt6EntryPoint in qmake ?

Scheduled Pinned Locked Moved Solved Qt 6
8 Posts 5 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Peyo83
    wrote on last edited by
    #1

    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

    jsulmJ 1 Reply Last reply
    0
    • kkoehneK Offline
      kkoehneK Offline
      kkoehne
      Moderators
      wrote on last edited by
      #6

      @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.

      Director R&D, The Qt Company

      P 1 Reply Last reply
      1
      • P Peyo83

        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

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @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?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Peyo83
          wrote on last edited by
          #3

          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‚solus

          Sorry 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)

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            It's not linked when you create a console program

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Peyo83
              wrote on last edited by
              #5

              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...

              1 Reply Last reply
              0
              • kkoehneK Offline
                kkoehneK Offline
                kkoehne
                Moderators
                wrote on last edited by
                #6

                @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.

                Director R&D, The Qt Company

                P 1 Reply Last reply
                1
                • kkoehneK kkoehne

                  @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.

                  P Offline
                  P Offline
                  Peyo83
                  wrote on last edited by
                  #7

                  @kkoehne
                  This is exactly what I was looking for !
                  Thank you so much, it works !

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Cupras
                    wrote on last edited by
                    #8

                    Hi,
                    i get the same error but in a visual studio project.
                    Did anyone know how i can add the -entrypoint in a vs project?

                    Thanks!

                    1 Reply Last reply
                    0
                    • C Cupras referenced this topic on

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved