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. Impossible to deploy Qt applications
Qt 6.11 is out! See what's new in the release blog

Impossible to deploy Qt applications

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 3.8k Views 2 Watching
  • 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.
  • GmemberG Offline
    GmemberG Offline
    Gmember
    wrote on last edited by
    #1

    I am having serious troubles in trying to deploy my new application built with Qt. The program runs fine when started from Qt Creator (all builds: debug, profile, release), but it crashes when started by double clicking on the .exe. An error dialog pops up with the following message:

    ?defaultTypeFor@QTimer@@CA?AW4TimerType@Qt@@H@Z could not be located in the dynamic link library C:\Users\SDT1\Documents\Scanner\Scanner_deploy\Scanner.exe
    

    I am using Qt 5.8.0 and I am building the project with MSVC2015_64 bit. I am using windeployqt.exe from C:\Qt\5.8\msvc2015_64\bin to dinamically link the Qt libraries.

    This problem started happening since I moved from the old connect syntax (with the macros SIGNAL and SLOT) to the new one with function pointers. I also started using QTimer::singleShot instead of QMetaObject::invokeMethod, and not surprising the error involves QTimer. However, the program works just fine from inside Qt Creator and I can't figure out where the issue is, since I am using windeployqt to get the right dlls.

    Also, why my .exe is referred to as "dinamic link library" in the error message? It's an .exe!

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Any chance it get hold of wrong Qt lib ?

      If possible test the deployment folder on a clean install. ( use virtual machine)

      Also double check that all needed DLLs were copied with windeployqt

      http://www.tripleboot.org/?p=138

      1 Reply Last reply
      1
      • GmemberG Offline
        GmemberG Offline
        Gmember
        wrote on last edited by
        #3

        Hi @mrjj , thank you for your reply. I solved the issue, but I'm still not sure what was going wrong: my Path variable was pointing to the folder of Qt version 5.7 (the only other version I have). I changed it to 5.8, rebooted and redeployed and it DIDN'T work. Then, I deleted the build folder, rebuilt and re-deployed and it DID work. So, the problem was with the build.

        However, how can this happen? I changed back the Path to Qt 5.7 and rebooted to make some tests. The problem appeared again, but I don't understand how the Path affects the build. Despite having Qt 5.7 in the Path, in Qt Creator the Compile Output shows all the Qt stuff pointing to the 5.8 folder (qmake.exe, uic.exe, include folders, ...). There is no reference to version 5.7. Only jom.exe is not from the Qt 5.8 folder, since it is in the Qt Creator folder. Maybe it's it that loads something from Qt 5.7, by looking at the Path? In the build toolchain, who uses the Path and who doesn't?

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

          Hi,

          That's because Qt Creator modifies internally the PATH environnement variable so that you always use the Qt version you're building your application with.

          Modifying your PATH environment variable globally like you are currently doing is really a bad idea.

          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
          2
          • GmemberG Offline
            GmemberG Offline
            Gmember
            wrote on last edited by
            #5

            Hi @SGaist ,

            I want to understand this, could you give me a few more details, or could you point me to some web content where I can find the relevant info?

            1. Why is it a really bad idea to change the variable globally? What can happen in practice?
            2. This solved the issue, and if I change the variable back to 5.7, the problem appers again. What should I do to solve it then?
            3. Why the new Qt installation didn't update the global variable? What is the point of having a variable pointing to 5.7 if I use 5.8 all the time now?
            4. Which parts of the Qt ecosystem use that global variable?

            Thank you!

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6
              1. Because all of a sudden, Qt application not finding one of their .dlls in the same folder as their executable will load the one they can find using PATH. Which is not something you want on any system.
              2. Don't put your development Qt binary folder in the PATH environment variable.
              3. The Qt SDK never touches that variable system wide.
              4. None

              The installation of the Qt SDK is self-contained and doesn't touch PATH system wide. Like I wrote before, Qt Creator modifies that variable internally to run your application. It does not touch anything system wide.

              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
              4
              • GmemberG Offline
                GmemberG Offline
                Gmember
                wrote on last edited by
                #7

                Ok thank you. I deleted the global variable and it works. I didn't think about deleting it because I thought it was supposed to be there. I didn't put it there, and I assumed that the installer did it. If the installer didn't put it there, then who did?

                Thank you for your help!

                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 Extensions
                • Unsolved