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. Project not building on windows
QtWS25 Last Chance

Project not building on windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 6 Posters 987 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.
  • C Offline
    C Offline
    Creaperdown
    wrote on last edited by Creaperdown
    #1

    Hey, I am currently working on a project, which works all fine on linux, but doesnt seem to build on windows.

    The error messages I get are: https://imgur.com/a/d8Kre0n

    I wouldnt exactly know what code to provide. What I am building is this: https://github.com/Librum-Reader/Librum.
    Does anyone have an idea why these errors could occur?

    I noticed that it shows me (at the bottom of the error message), that there is an undefined reference to my signals, which I find weird, since I use the Q_OBJECT macro in all my classes

    Thanks in advance

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

      Wouldn't it be better to ask the author of the project?

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

      C 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Wouldn't it be better to ask the author of the project?

        C Offline
        C Offline
        Creaperdown
        wrote on last edited by
        #3

        @Christian-Ehrlicher Well, I am the author

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

          "undefined reference" errors on Windows are usually related to the fact that, on Windows, you have to explicitly export and import symbols if these symbols are used across library/module boundaries.

          See also https://doc.qt.io/qt-6/sharedlibrary.html

          Director R&D, The Qt Company

          C 2 Replies Last reply
          2
          • kkoehneK kkoehne

            "undefined reference" errors on Windows are usually related to the fact that, on Windows, you have to explicitly export and import symbols if these symbols are used across library/module boundaries.

            See also https://doc.qt.io/qt-6/sharedlibrary.html

            C Offline
            C Offline
            Creaperdown
            wrote on last edited by
            #5

            @kkoehne I see, I'll try this. Is it generally enough to put Q_DECL_EXPORT infront of every class I want to use from another binary?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Not Q_DECL_EXPORT but yes you have to export all the classes you want to use from your library.

              See how it is done in the documentation @kkoehne linked.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • ali-aydinA Offline
                ali-aydinA Offline
                ali-aydin
                wrote on last edited by
                #7

                Hi,
                it maybe depend on your access permission to Storage

                SGaistS 1 Reply Last reply
                0
                • ali-aydinA ali-aydin

                  Hi,
                  it maybe depend on your access permission to Storage

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @ali-aydin said in Project not building on windows:

                  Hi,
                  it maybe depend on your access permission to Storage

                  No it's not. If it was access permission related, @Creaperdown wouldn't be able to build the library in the first place.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • kkoehneK kkoehne

                    "undefined reference" errors on Windows are usually related to the fact that, on Windows, you have to explicitly export and import symbols if these symbols are used across library/module boundaries.

                    See also https://doc.qt.io/qt-6/sharedlibrary.html

                    C Offline
                    C Offline
                    Creaperdown
                    wrote on last edited by
                    #9

                    @kkoehne I've tried following the docs on a small project I set up (which has the same issue, I think my other project has) but it still doesnt work. https://github.com/Creapermann/Temp

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

                      @Creaperdown , I just successfully compiled the latest HEAD (d5e98b8c6cc17abe) of your repository on Windows, with MinGW and MSVC:

                      C:\dev\tmp\Temp>cmake -B mingw-build -GNinja -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64 .
                      -- The CXX compiler identification is GNU 11.2.0
                      -- Detecting CXX compiler ABI info
                      -- Detecting CXX compiler ABI info - done
                      -- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/c++.exe - skipped
                      -- Detecting CXX compile features
                      -- Detecting CXX compile features - done
                      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
                      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
                      -- Found Threads: TRUE
                      -- Performing Test HAVE_STDATOMIC
                      -- Performing Test HAVE_STDATOMIC - Success
                      -- Found WrapAtomic: TRUE
                      -- Found WrapVulkanHeaders: C:/VulkanSDK/1.2.176.1/Include
                      -- Configuring done
                      -- Generating done
                      -- Build files have been written to: C:/dev/tmp/Temp/mingw-build
                      
                      C:\dev\tmp\Temp>cmake --build mingw-build
                      [21/21] Linking CXX executable appTesting.exe
                      

                      What compiler are you using, and what is the exact compiler output you get?

                      Director R&D, The Qt Company

                      C 1 Reply Last reply
                      1
                      • kkoehneK kkoehne

                        @Creaperdown , I just successfully compiled the latest HEAD (d5e98b8c6cc17abe) of your repository on Windows, with MinGW and MSVC:

                        C:\dev\tmp\Temp>cmake -B mingw-build -GNinja -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64 .
                        -- The CXX compiler identification is GNU 11.2.0
                        -- Detecting CXX compiler ABI info
                        -- Detecting CXX compiler ABI info - done
                        -- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/c++.exe - skipped
                        -- Detecting CXX compile features
                        -- Detecting CXX compile features - done
                        -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
                        -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
                        -- Found Threads: TRUE
                        -- Performing Test HAVE_STDATOMIC
                        -- Performing Test HAVE_STDATOMIC - Success
                        -- Found WrapAtomic: TRUE
                        -- Found WrapVulkanHeaders: C:/VulkanSDK/1.2.176.1/Include
                        -- Configuring done
                        -- Generating done
                        -- Build files have been written to: C:/dev/tmp/Temp/mingw-build
                        
                        C:\dev\tmp\Temp>cmake --build mingw-build
                        [21/21] Linking CXX executable appTesting.exe
                        

                        What compiler are you using, and what is the exact compiler output you get?

                        C Offline
                        C Offline
                        Creaperdown
                        wrote on last edited by
                        #11

                        @kkoehne I am using the same setup you do. I have Qt 6.3.1 and am using mingw_64. When I am running the exact same command you do, in the command line, I get following error:

                        cmake -B mingw-build -GNinja -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64 .
                        -- The CXX compiler identification is GNU 6.3.0
                        -- Detecting CXX compiler ABI info
                        -- Detecting CXX compiler ABI info - done
                        -- Check for working CXX compiler: C:/MinGW/bin/c++.exe - skipped
                        -- Detecting CXX compile features
                        -- Detecting CXX compile features - done
                        CMake Error at CMakeLists.txt:22 (find_package):
                          Could not find a configuration file for package "Qt6" that is compatible
                          with requested version "6.2".
                        
                          The following configuration files were considered but not accepted:
                        
                            C:/Qt/6.3.1/mingw_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.3.1 (64bit)
                        
                        
                        
                        -- Configuring incomplete, errors occurred!
                        See also "C:/Users/prtnp/Programming/Temp/Temp/mingw-build/CMakeFiles/CMakeOutput.log".
                        

                        Do you have an idea why this doesnt work? Looking around I only find that not using CMAKE_PREFIX_PATH could cause this, but I do.

                        Also, when using QtCreator, it compiles but it doesnt run. Does the application run for you?

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          Creaperdown
                          wrote on last edited by
                          #12

                          Also, I've realized I am using mingw_64, which exports all symbols by default, so I don't think that exporting the symbols is the problem. Does anyone have another idea?

                          1 Reply Last reply
                          0
                          • cristian-adamC Offline
                            cristian-adamC Offline
                            cristian-adam
                            wrote on last edited by
                            #13

                            In your compilation example you have:

                            -- The CXX compiler identification is GNU 6.3.0
                            

                            Please use a newer MinGW. The one from Qt SDK should be 11.2.0.

                            In your temp project you have:

                            find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
                            

                            Please remove the 6.2 part, which doesn't play well with Qt version 6.3.1 given via -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64.

                            1 Reply Last reply
                            4
                            • kkoehneK Offline
                              kkoehneK Offline
                              kkoehne
                              Moderators
                              wrote on last edited by
                              #14

                              @cristian-adam said in Project not building on windows:

                              Please remove the 6.2 part, which doesn't play well with Qt version 6.3.1 given via -DCMAKE_PREFIX_PATH=C:\Qt\6.3.1\mingw_64.

                              I think this should actually be fine, because 6.3.1 is compatible with 6.2, and no EXACT is set.

                              But yes, the GCC compiler version is too old.

                              Director R&D, The Qt Company

                              1 Reply Last reply
                              2

                              • Login

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