Congratulations to our 2022 Qt Champions!

[Solved] Qt compiled, but applications won't start

  • Hi,

    I "successfully" compiled Qt 4.7.2 with msvc10 on a windows 7 64bit machine.

    My call to configure looked like this
    configure.exe -qt-sql-sqlite -exceptions -platform win32-msvc2010 -no-qt3support -no-webkit -no-phonon -no-script -no-scripttools -opensource

    My problem is, that the applications deployed to the 'bin' directory fail to start (linguist, designer, assistant). Launching one of them ends up in a dialog saying "XXX has stopped working".

    The same happens for the example programs.

    When I compile my own applications, they work when compiled in debug mode, switching to release leads to applications having the problems mentioned above.

    I googled a lot, but didn't find anyone having similar problems.

    [ As I don't use phonon (-no-phonon), I did not install the PSDK and DirectX SDK linked to at the general requirements page. ]

    I'd appreciate any help - thanks in advance

  • Did you add the Qt bin dir to the PATH? If not, you should add it. It's needed so programs will find the Qt DLLs.

  • yes, the bin dir is in the path (I set the 'QTDIR' environment variable and put @%QTDIR%\bin@ into the path).
    I started applications like the linguist, assistant, ... from right out of the bin directory. So that should not be a source of the problem (I think this also excludes that I have multiple conflicting installations of Qt on my machine)

  • Are you sure your program is loading the correct version of Qt ?

    I had the same issue with an old p4 version, bundling a fairly old qt version with standard name.

    my programs in release were trying to load these dlls (e.g. qtCore.dll) whereas in debug, I had only mine (qtCore4d.dll)

    My advice : try to put QTDIR/bin at begin of your path instead of end : if it works, you've won ! Try to pinpoint where in the path is the conflicting lib (looks like a binary incompatibility in the interface, like trying to load 32bits lib from your 64bits program)


  • As far as I would know the current folder is used to look for dlls before any other folder in the path, so that should not be a problem when launching the applications in the bin directory of Qt using it as working directory.

    I just copied the executables from the bin directory together with all the dlls and some programs I wrote myself to my laptop (also 64 bit windows 7) that has no Qt on it.
    As expected I have exactly the same problems there.

    Sidenote: Using the same configure options, but msvc9 and win xp 32 bit in a virtual machine produces applications without problems, but I hate that it just doesn't work on my actual machine.

    About the 32/64 bit incompatibility ... I ran configure and nmake using the "Visual Studio x64 Win64 Command Prompt (2010)" where cl/? says:
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cl /?
    Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64

  • I had the same problem.
    Compiled Qt several times using msvc-2010 x64 with various configure options and wound up with the same results each time:
    Qt Tools didn't work, as did most of the examples. Same error messages as you had.

    After googling around for a bit I found out that it's a bug in the VC 2010 compiler. Compiling for x64 in release-mode with
    optimization level 2 (which is the case with Qt), and the VC screws up badly.

    Long story short: Microsoft released a hotfix for the problem. Just download and install it. Recompile Qt and have fun.
    "VC patch":

    If you're interested in the whole story, "here": is the bug report.

    I recommend using jom instead of nmake for multicore CPUs. It's basically a nmake clone but executes several jobs at once based on the number of cores. (as GNU make with the j-option)
    It sped up my builds enormously.
    "Newest version":

    Hope this helps.

  • Thank you so much, that perfectly solved my problem.

Log in to reply