Important: Please read the Qt Code of Conduct -

Running an Application Independent of Qt - Qt 5.0.2, Win 7 64-bit, VS '12

  • I'm new to Qt and application development. I've developed an application in Qt Creator that I would like to be able to run independent of Qt itself and embedded with all of the library files that the application would need. Ideally I'd like to be something that my colleagues could download to their computers. I've tried to solve this many times already. I'm not sure exactly what info I should include so I'll include all the steps that I've taken so far.

    First, what I'm using:
    Qt 5.0.2
    compiling w/ Visual Studio 2012
    Windows 7 - 64 bit (bootcamp on a Mac)

    I found the .exe file in the debug project folder, and, when I tried to run it, the following error message appeared: "The program can't start because Qt5Widgetsd.dll is missing from your computer. Try reinstalling the program to fix this problem." If I add this .dll file, I am prompted to add another, then another, until I have a 300+ MB folder of files. The application will run then, but only if Qt and Visual Studio '12 are installed and it must be in that folder.

    Then I looked all over Google to find out how to "deploy" the application. I found some forums on building Qt statically, so I looked into that. I found a list of instructions that I followed to the best of my ability, but it was unsuccessful. My sense was that fact that I was using a different version than the instructions referred to was the reason for some of the issues. Here is a link to the instructions that I followed:
    When I tried to follow the instructions regarding command prompt, command prompt would not even recognize the "configure" command, leading me to believe that my understanding of the issue itself is worse than I thought.

    If there is any other information I can provide that will help someone help me please let me know. Thank you for any and all help in advance!

  • welcome to devnet

    The size of your application plus the dlls depends on the compile mode. Debug mode generate really large dlls and also the debug version of your application is really big. They are not meant for redistribution, but for debugging and testing.
    The release compilations are considerably smaller.
    Also static debug builds are big. This is not necessarily a relief.

    In order to find out the dependencies you should use the "dependency walker as described in the wiki.":

  • Moderators

    Hi Lazer1208,

    If your application is asking for DLLs that end with 'd' (e.g. your Qt5Widgetsd.dll), that means it was compiled in Debug mode and will require huge DLLs. It will have much poorer performance too. Build in Release mode when your application is ready for distribution.

    That wiki article refers to compiling the Qt library, not your application. If you want to build statically-linked applications, you'll need to build Qt from scratch first (it can take a few hours, depending on your computer), and then build your application. Also, like koahnig said, static builds produce huge .exe files.

    Read the official guide for deploying Qt 5 applications on Windows: Pay attention to the "Shared Libraries" section, but skip the "Building Qt as a Shared Library" subsection (because you already have the DLLS) and the "Linking the Application to Qt as a Shared Library" subsection (because Qt Creator already takes care of that for you). Pay attention to the "Application Dependencies" section too.

  • JKSH,

    The link you referred me to was very helpful. I statically built Qt successfully and completed all but the last step of creating a .exe file of my application.

    Under the Linking the Application to the Static Version of Qt section, I am stuck on the step where I have to simply type "nmake" into the command prompt. When I do this, I get the following error message:

    \OUT:release\LED_Ring3.exe @C:\Users\MGAusten\AppData\Local\Temp\nmF94F.tmp
    The system cannot find the path specified.
    NMAKE : fatal error U1077: " : return code '0x1'
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\nmake.exe"' : return code '0x2'

    I am currently looking into the issue but so far no luck.

  • koahnig,

    Thank you for clarifying that for me. I wasn't sure what the difference was.

  • Moderators

    I have no experience with statically-linked Qt programs, sorry. Start a new thread with a title that mentions static-linking -- someone else with the necessary experience will be more likely to see your question then.

Log in to reply