Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. emit(s) build errors using mingw64
Qt 6.12 LTS is out! See what's new in the release blog

emit(s) build errors using mingw64

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 1.2k 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.
  • S Offline
    S Offline
    shathcock
    wrote on last edited by
    #1

    Sorry for the several posts the last couple of days but here is the latest. I have an application that has been working for a month and I have been making minor changes to it. I was using msvc 2019 until I had to do an update to it and everything just seemed to fall apart. Finally I have given up and decided to use Mingw64 instead. Everything builds fine except I get a undefined reference error to every emit call in the program, a couple of errors - undefined reference to vtable and finally collect2.exe returned exit status of 1. Any Ideas before I just give up on Qt. I used to use it exclusively years ago and never had the kind of problems I seem to be fighting with every day now. Oh I am using Cmake not qmake with Qt 6.0.1. Any help would be greatly appreciated.

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

      Please show your cmake script. Did you enable AUTOMOC or do you use another way to generate the moc files?

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

      S 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        Please show your cmake script. Did you enable AUTOMOC or do you use another way to generate the moc files?

        S Offline
        S Offline
        shathcock
        wrote on last edited by Christian Ehrlicher
        #3

        @Christian-Ehrlicher When you say the Cmake script do you mean the CmakeLists.txt if so here is what I have.

        cmake_minimum_required(VERSION 3.5)
        
        project(DXT LANGUAGES CXX)
        
        set(CMAKE_INCLUDE_CURRENT_DIR ON)
        
        set(CMAKE_AUTOUIC ON)
        set(CMAKE_AUTOMOC ON)
        set(CMAKE_AUTORCC ON)
        
        set(CMAKE_CXX_STANDARD 11)
        set(CMAKE_CXX_STANDARD_REQUIRED ON)
        
        # QtCreator supports the following variables for Android, which are identical to qmake Android variables.
        # Check https://doc.qt.io/qt/deployment-android.html for more information.
        # They need to be set before the find_package( ...) calls below.
        
        #if(ANDROID)
        #    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
        #    if (ANDROID_ABI STREQUAL "armeabi-v7a")
        #        set(ANDROID_EXTRA_LIBS
        #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
        #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
        #    endif()
        #endif()
        
        find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
        find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
        
        set(PROJECT_SOURCES
            main.cpp
            mainwindow.cpp
            ditaTransform.cpp
            procedure.cpp
            processDitaConcept.cpp
            processDitaTitle.cpp
            processDitaHeaderandProlog.cpp
            processDitaConbody.cpp
            processDitaSteps.cpp
            processBranching.cpp
            writeXmlFile.cpp
            mainwindow.h
            ditaTransform.h
            procedure.h
            mainwindow.ui
            icons.qrc
        )
        
        if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
            set(app_icon_resource_windows "${CMAKE_CURRENT_SOURCE_DIR}/icons.rc")
            qt_add_executable(DXT ${PROJECT_SOURCES} ${app_icon_resource_windows})
        
            #qt_add_executable(DXT
            #    ${PROJECT_SOURCES}
            #)
        else()
            if(ANDROID)
                add_library(DXT SHARED
                    ${PROJECT_SOURCES}
                )
            else()
                add_executable(DXT
                    ${PROJECT_SOURCES}
                )
            endif()
        endif()
        
        target_link_libraries(DXT PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Are moc files generated in to build dir? Do you use a clean build dir? Are you sure you use the correct Qt version (for MinGW) and did not mix up with the MSVC binaries?

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

          S 1 Reply Last reply
          3
          • Christian EhrlicherC Christian Ehrlicher

            Are moc files generated in to build dir? Do you use a clean build dir? Are you sure you use the correct Qt version (for MinGW) and did not mix up with the MSVC binaries?

            S Offline
            S Offline
            shathcock
            wrote on last edited by
            #5

            @Christian-Ehrlicher Wow that did it...Thank you very much I have no idea what happened. It is a brand new install of Qt 6.0.1 with a brand new build directory. I deleted the directory and did a build again and it works. Thanks again!!

            Christian EhrlicherC 1 Reply Last reply
            2
            • S shathcock

              @Christian-Ehrlicher Wow that did it...Thank you very much I have no idea what happened. It is a brand new install of Qt 6.0.1 with a brand new build directory. I deleted the directory and did a build again and it works. Thanks again!!

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @shathcock Nice. lease don't forget to mark the topic as solved then.

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

              S 1 Reply Last reply
              2
              • Christian EhrlicherC Christian Ehrlicher

                @shathcock Nice. lease don't forget to mark the topic as solved then.

                S Offline
                S Offline
                shathcock
                wrote on last edited by
                #7

                @Christian-Ehrlicher Just about to Thanks again!! It has been a very frustrating couple of days.

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

                  The first thing to do with sch problems is to start with a clean build dir :)

                  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
                  1

                  • Login

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