Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt6 CMAKE - Undefined Reference to 'WinMain'

Qt6 CMAKE - Undefined Reference to 'WinMain'

Scheduled Pinned Locked Moved Solved General and Desktop
cmakeqt6
16 Posts 2 Posters 4.1k 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.
  • Christian EhrlicherC Christian Ehrlicher

    Please post the full error message

    wrt main.cpp compiler error - if you want to use a library (in the case QtWidgets) your target also must link against it which it currently doesn't.

    K Offline
    K Offline
    Kevin470
    wrote on last edited by
    #3

    @Christian-Ehrlicher Thank you for responding.

    :-1: error: CMake process exited with exit code 1.
    :-1: error: CMake returned error code: 1
    :-1: error: C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
    :-1: error: collect2.exe: error: ld returned 1 exit status
    C:\Users\UserName\Documents\Qt_Projects\cmake_with_tests\mainwindow.hpp:4: error: QMainWindow: No such file or directory
    In file included from C:/Users/UserName/Documents/Qt_Projects/cmake_with_tests/main.cpp:2:
    C:/Users/UserName/Documents/Qt_Projects/cmake_with_tests/mainwindow.hpp:4:10: fatal error: QMainWindow: No such file or directory
        4 | #include <QMainWindow>
          |          ^~~~~~~~~~~~~
    :-1: error: ninja: build stopped: subcommand failed.
    

    These are the full error messages.

    Isn't my Target linking Qt Widgets here? -> target_link_libraries(PROJECT_SOURCES PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

    I am learning CMake, sorry for the errors I make. Thanks

    Christian EhrlicherC 1 Reply Last reply
    0
    • K Kevin470

      @Christian-Ehrlicher Thank you for responding.

      :-1: error: CMake process exited with exit code 1.
      :-1: error: CMake returned error code: 1
      :-1: error: C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
      :-1: error: collect2.exe: error: ld returned 1 exit status
      C:\Users\UserName\Documents\Qt_Projects\cmake_with_tests\mainwindow.hpp:4: error: QMainWindow: No such file or directory
      In file included from C:/Users/UserName/Documents/Qt_Projects/cmake_with_tests/main.cpp:2:
      C:/Users/UserName/Documents/Qt_Projects/cmake_with_tests/mainwindow.hpp:4:10: fatal error: QMainWindow: No such file or directory
          4 | #include <QMainWindow>
            |          ^~~~~~~~~~~~~
      :-1: error: ninja: build stopped: subcommand failed.
      

      These are the full error messages.

      Isn't my Target linking Qt Widgets here? -> target_link_libraries(PROJECT_SOURCES PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

      I am learning CMake, sorry for the errors I make. Thanks

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

      @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

      Isn't my Target linking Qt Widgets here? -> target_link_libraries(PROJECT_SOURCES PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

      No, you're on the wrong target - main.cpp is compiled for target PROJ_TARGET (strange target name btw)

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

      K 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

        Isn't my Target linking Qt Widgets here? -> target_link_libraries(PROJECT_SOURCES PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

        No, you're on the wrong target - main.cpp is compiled for target PROJ_TARGET (strange target name btw)

        K Offline
        K Offline
        Kevin470
        wrote on last edited by
        #5

        @Christian-Ehrlicher Yeah the names are just for me to understand where the differences lie.
        Do you mean like this target_link_libraries(PROJ_TARGET PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PRIVATE PROJECT_SOURCES)
        This removes the error undefined Reference to 'WinMain'. But the missing QMainWindow still remains.

        Christian EhrlicherC 2 Replies Last reply
        0
        • K Kevin470

          @Christian-Ehrlicher Yeah the names are just for me to understand where the differences lie.
          Do you mean like this target_link_libraries(PROJ_TARGET PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PRIVATE PROJECT_SOURCES)
          This removes the error undefined Reference to 'WinMain'. But the missing QMainWindow still remains.

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

          @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

          target_link_libraries(PROJ_TARGET PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PROJECT_SOURCES)

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

          K 2 Replies Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

            target_link_libraries(PROJ_TARGET PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PROJECT_SOURCES)

            K Offline
            K Offline
            Kevin470
            wrote on last edited by
            #7

            @Christian-Ehrlicher This has the same error as well unfortunately. This removed the 'WinMain' issue. But missing QMainWindow still remains.

            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

              target_link_libraries(PROJ_TARGET PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PROJECT_SOURCES)

              K Offline
              K Offline
              Kevin470
              wrote on last edited by
              #8

              @Christian-Ehrlicher I am trying to take a similar approach to KDAB's example with the Qt Console Project. They did the same thing where they make an add_library called "QWAMLib" where they add all the header and source files except main.cpp.
              Then they do a target_link_libraries to the "QWAMLib" with Qt${QT_VERSION_MAJOR}::Core. And then they make an executable with the main.cpp and target link libraries to the QWAMLib. The example is as follows.

              cmake_minimum_required(VERSION 3.9)
              project(UnitTests)
              set(CMAKE_CXX_STANDARD 11)
              set(CMAKE_INCLUDE_CURRENT_DIR ON)
              
              find_package(QT NAMES Qt5 Qt6 CONFIG REQUIRED COMPONENTS Core Test)
              find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Test)
              set(CMAKE_AUTOMOC TRUE)
              set(CMAKE_AUTORCC TRUE)
              
              add_library(QWAMLib SHARED Gadgets.h NewWay.h NewWayUsingNameSpace.h OriginalWay.h)
              target_link_libraries(QWAMLib Qt${QT_VERSION_MAJOR}::Core)
              
              add_executable(QWAM main.cpp)
              target_link_libraries(QWAM QWAMLib)
              
              add_subdirectory(Tests)
              

              This works. I thought what I did with the QMainWindow is very similar to this

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

                No need to show me CMake examples. Please show your current CMakeLists.txt

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

                K 1 Reply Last reply
                1
                • Christian EhrlicherC Christian Ehrlicher

                  No need to show me CMake examples. Please show your current CMakeLists.txt

                  K Offline
                  K Offline
                  Kevin470
                  wrote on last edited by
                  #10

                  @Christian-Ehrlicher Sorry about that. This is my Current CMakeLists.txt

                  cmake_minimum_required(VERSION 3.5)
                  
                  project(cmake_with_tests VERSION 0.1 LANGUAGES CXX)
                  
                  set(CMAKE_AUTOUIC ON)
                  set(CMAKE_AUTOMOC ON)
                  set(CMAKE_AUTORCC ON)
                  
                  set(CMAKE_CXX_STANDARD 17)
                  set(CMAKE_CXX_STANDARD_REQUIRED ON)
                  
                  option(ENABLE_TESTS "Enable Tests" ON)
                  
                  find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Test)
                  find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Test)
                  
                  add_library(PROJECT_SOURCES SHARED
                  #        main.cpp
                          mainwindow.cpp
                          mainwindow.hpp
                          mainwindow.ui
                          adder.hpp
                          adder.cpp
                  )
                  #target_link_libraries(PROJECT_SOURCES PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
                  
                  if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
                      qt_add_executable(PROJ_TARGET
                          MANUAL_FINALIZATION
                          main.cpp
                      )
                  else()
                      add_executable(PROJ_TARGET
                          main.cpp
                      )
                  endif()
                  
                  target_link_libraries(PROJ_TARGET PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PROJECT_SOURCES)
                  
                  set_target_properties(PROJ_TARGET PROPERTIES
                      MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
                      MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
                      MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
                      MACOSX_BUNDLE TRUE
                      WIN32_EXECUTABLE TRUE
                      OUTPUT_NAME "CMake_Testing"
                  )
                  
                  install(TARGETS PROJ_TARGET
                      BUNDLE DESTINATION .
                      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
                  
                  if(ENABLE_TESTS)
                      add_subdirectory(tests)
                  endif()
                  
                  if(QT_VERSION_MAJOR EQUAL 6)
                      qt_finalize_executable(PROJ_TARGET)
                  endif()
                  
                  1 Reply Last reply
                  0
                  • K Kevin470

                    @Christian-Ehrlicher Yeah the names are just for me to understand where the differences lie.
                    Do you mean like this target_link_libraries(PROJ_TARGET PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PRIVATE PROJECT_SOURCES)
                    This removes the error undefined Reference to 'WinMain'. But the missing QMainWindow still remains.

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

                    @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

                    But the missing QMainWindow still remains.

                    No, it's now no longer in main.cpp but mainwindow.cpp because you now don't link your library against Qt6::Widgets because it's commented out

                    #target_link_libraries(PROJECT_SOURCES PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

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

                    K 1 Reply Last reply
                    1
                    • Christian EhrlicherC Christian Ehrlicher

                      @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

                      But the missing QMainWindow still remains.

                      No, it's now no longer in main.cpp but mainwindow.cpp because you now don't link your library against Qt6::Widgets because it's commented out

                      #target_link_libraries(PROJECT_SOURCES PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

                      K Offline
                      K Offline
                      Kevin470
                      wrote on last edited by
                      #12

                      @Christian-Ehrlicher Thank you so much.

                      I have a question on the linking. In the first CMakeLists.txt I showed,
                      I am adding a library called PROJECT_SOURCES which is then linked with the QT Widgets. And the PROJECT_SOURCES is linked to the executable with main.cpp. Won't that link the QT Widgets along with it as well? It might be a bad question, but it would help me understand how this works.

                      Your suggestion that commenting it has brought the problem again has helped. This has cleared up the missing QMainWindow error. But the Undefined reference to 'WinMain' is thrown now.

                      Christian EhrlicherC 1 Reply Last reply
                      0
                      • K Kevin470

                        @Christian-Ehrlicher Thank you so much.

                        I have a question on the linking. In the first CMakeLists.txt I showed,
                        I am adding a library called PROJECT_SOURCES which is then linked with the QT Widgets. And the PROJECT_SOURCES is linked to the executable with main.cpp. Won't that link the QT Widgets along with it as well? It might be a bad question, but it would help me understand how this works.

                        Your suggestion that commenting it has brought the problem again has helped. This has cleared up the missing QMainWindow error. But the Undefined reference to 'WinMain' is thrown now.

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

                        @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

                        Won't that link the QT Widgets along with it as well? It might be a bad question, but it would help me understand how this works.

                        No because you told CMake that it's a PRIVATE library instead PUBLIC - see the cmake documentation. Linking it PRIVATE is wrong in my pov because your public headers include QtWidgets headers so it should be linked public.

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

                        K 1 Reply Last reply
                        1
                        • Christian EhrlicherC Christian Ehrlicher

                          @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

                          Won't that link the QT Widgets along with it as well? It might be a bad question, but it would help me understand how this works.

                          No because you told CMake that it's a PRIVATE library instead PUBLIC - see the cmake documentation. Linking it PRIVATE is wrong in my pov because your public headers include QtWidgets headers so it should be linked public.

                          K Offline
                          K Offline
                          Kevin470
                          wrote on last edited by
                          #14

                          @Christian-Ehrlicher I understand. This is my current CMakeLists.txt:

                          cmake_minimum_required(VERSION 3.5)
                          
                          project(cmake_with_tests VERSION 0.1 LANGUAGES CXX)
                          
                          set(CMAKE_AUTOUIC ON)
                          set(CMAKE_AUTOMOC ON)
                          set(CMAKE_AUTORCC ON)
                          
                          set(CMAKE_CXX_STANDARD 17)
                          set(CMAKE_CXX_STANDARD_REQUIRED ON)
                          
                          option(ENABLE_TESTS "Enable Tests" ON)
                          
                          find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Test)
                          find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Test)
                          
                          add_library(PROJECT_SOURCES SHARED
                          #        main.cpp
                                  mainwindow.cpp
                                  mainwindow.hpp
                                  mainwindow.ui
                                  adder.hpp
                                  adder.cpp
                          )
                          target_link_libraries(PROJECT_SOURCES PUBLIC Qt${QT_VERSION_MAJOR}::Widgets)
                          
                          if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
                              qt_add_executable(PROJ_TARGET
                                  MANUAL_FINALIZATION
                                  main.cpp
                              )
                          else()
                              add_executable(PROJ_TARGET
                                  main.cpp
                              )
                          endif()
                          
                          target_link_libraries(PROJ_TARGET PUBLIC Qt${QT_VERSION_MAJOR}::Widgets PROJECT_SOURCES)
                          
                          set_target_properties(PROJ_TARGET PROPERTIES
                              MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
                              MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
                              MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
                              MACOSX_BUNDLE TRUE
                              WIN32_EXECUTABLE TRUE
                              OUTPUT_NAME "CMake_Testing"
                          )
                          
                          install(TARGETS PROJ_TARGET
                              BUNDLE DESTINATION .
                              LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
                          
                          if(ENABLE_TESTS)
                              add_subdirectory(tests)
                          endif()
                          
                          if(QT_VERSION_MAJOR EQUAL 6)
                              qt_finalize_executable(PROJ_TARGET)
                          endif()
                          

                          Under errors, I have these following errors; The WinMain error is predominant.

                          :-1: error: CMake process exited with exit code 1.
                          :-1: error: CMake returned error code: 1
                          :-1: error: C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
                          :-1: error: collect2.exe: error: ld returned 1 exit status
                          :-1: error: ninja: build stopped: subcommand failed.
                          

                          And under General Messages, I checked what CMake prints as an error, it says:

                          CMake Error:
                            Running
                          
                             'C:/Qt/Tools/Ninja/ninja.exe' '-C' 'C:/Users/UserName/Documents/Qt_Projects/build-cmake_with_tests-Desktop_Qt_6_4_1_MinGW_64_bit-Debug' '-t' 'recompact'
                          
                            failed with:
                          
                             ninja: error: failed recompaction: Permission denied
                          
                          Christian EhrlicherC 1 Reply Last reply
                          0
                          • K Kevin470

                            @Christian-Ehrlicher I understand. This is my current CMakeLists.txt:

                            cmake_minimum_required(VERSION 3.5)
                            
                            project(cmake_with_tests VERSION 0.1 LANGUAGES CXX)
                            
                            set(CMAKE_AUTOUIC ON)
                            set(CMAKE_AUTOMOC ON)
                            set(CMAKE_AUTORCC ON)
                            
                            set(CMAKE_CXX_STANDARD 17)
                            set(CMAKE_CXX_STANDARD_REQUIRED ON)
                            
                            option(ENABLE_TESTS "Enable Tests" ON)
                            
                            find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Test)
                            find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Test)
                            
                            add_library(PROJECT_SOURCES SHARED
                            #        main.cpp
                                    mainwindow.cpp
                                    mainwindow.hpp
                                    mainwindow.ui
                                    adder.hpp
                                    adder.cpp
                            )
                            target_link_libraries(PROJECT_SOURCES PUBLIC Qt${QT_VERSION_MAJOR}::Widgets)
                            
                            if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
                                qt_add_executable(PROJ_TARGET
                                    MANUAL_FINALIZATION
                                    main.cpp
                                )
                            else()
                                add_executable(PROJ_TARGET
                                    main.cpp
                                )
                            endif()
                            
                            target_link_libraries(PROJ_TARGET PUBLIC Qt${QT_VERSION_MAJOR}::Widgets PROJECT_SOURCES)
                            
                            set_target_properties(PROJ_TARGET PROPERTIES
                                MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
                                MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
                                MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
                                MACOSX_BUNDLE TRUE
                                WIN32_EXECUTABLE TRUE
                                OUTPUT_NAME "CMake_Testing"
                            )
                            
                            install(TARGETS PROJ_TARGET
                                BUNDLE DESTINATION .
                                LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
                            
                            if(ENABLE_TESTS)
                                add_subdirectory(tests)
                            endif()
                            
                            if(QT_VERSION_MAJOR EQUAL 6)
                                qt_finalize_executable(PROJ_TARGET)
                            endif()
                            

                            Under errors, I have these following errors; The WinMain error is predominant.

                            :-1: error: CMake process exited with exit code 1.
                            :-1: error: CMake returned error code: 1
                            :-1: error: C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
                            :-1: error: collect2.exe: error: ld returned 1 exit status
                            :-1: error: ninja: build stopped: subcommand failed.
                            

                            And under General Messages, I checked what CMake prints as an error, it says:

                            CMake Error:
                              Running
                            
                               'C:/Qt/Tools/Ninja/ninja.exe' '-C' 'C:/Users/UserName/Documents/Qt_Projects/build-cmake_with_tests-Desktop_Qt_6_4_1_MinGW_64_bit-Debug' '-t' 'recompact'
                            
                              failed with:
                            
                               ninja: error: failed recompaction: Permission denied
                            
                            Christian EhrlicherC Offline
                            Christian EhrlicherC Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on last edited by
                            #15

                            @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

                            ninja: error: failed recompaction: Permission denied

                            You run ninja as root before which you must not do.
                            Re-create your build dir or change the permissions / owner.

                            Please also post some more lines - you only show the error message but not which command creates it.

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

                            K 1 Reply Last reply
                            1
                            • Christian EhrlicherC Christian Ehrlicher

                              @Kevin470 said in Qt6 CMAKE - Undefined Reference to 'WinMain':

                              ninja: error: failed recompaction: Permission denied

                              You run ninja as root before which you must not do.
                              Re-create your build dir or change the permissions / owner.

                              Please also post some more lines - you only show the error message but not which command creates it.

                              K Offline
                              K Offline
                              Kevin470
                              wrote on last edited by
                              #16

                              @Christian-Ehrlicher
                              This was the full messages that it printed.

                              Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Users/UserName/Documents/Qt_Projects/cmake_with_tests -B C:/Users/UserName/Documents/Qt_Projects/build-cmake_with_tests-Desktop_Qt_6_4_1_MinGW_64_bit-Debug in C:\Users\UserName\Documents\Qt_Projects\build-cmake_with_tests-Desktop_Qt_6_4_1_MinGW_64_bit-Debug.
                              -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
                              -- Configuring done
                              -- Generating done
                              CMake Error:
                                Running
                              
                                 'C:/Qt/Tools/Ninja/ninja.exe' '-C' 'C:/Users/UserName/Documents/Qt_Projects/build-cmake_with_tests-Desktop_Qt_6_4_1_MinGW_64_bit-Debug' '-t' 'recompact'
                              
                                failed with:
                              
                                 ninja: error: failed recompaction: Permission denied
                              
                              
                              
                              CMake Error:
                                Running
                              
                                 'C:/Qt/Tools/Ninja/ninja.exe' '-C' 'C:/Users/UserName/Documents/Qt_Projects/build-cmake_with_tests-Desktop_Qt_6_4_1_MinGW_64_bit-Debug' '-t' 'restat' 'build.ninja'
                              
                                failed with:
                              
                                 ninja: error: failed recompaction: Permission denied
                              
                              
                              
                              CMake Generate step failed.  Build files cannot be regenerated correctly.
                              CMake process exited with exit code 1.
                              
                              Elapsed time: 00:01.
                              

                              I deleted the CMakeLists.txt.user file and reconfigured it from scratch. Now it builds fine and it works like expected.
                              Thank you so much for your time and your help.

                              1 Reply Last reply
                              0

                              • Login

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