Qt application gives 0xc000007b error



  • Hi everbody,

    I've install qt-opensource-windows-x86-msvc2015_64-5.8.0 and qt-vs-tools-msvc2015-2.1.1 on 64-bit Windows 10. Then, I've created an empty project and when run it via F5 (and also Ctrl + F5) key in Visual Studio 2015 in Release(x64) mode, everything works fine. However, running it via double click on the created .exe file gives 0xc000007b error. This error is caused by 32-bit 64-bit confusion but all the things are 64-bit. Any idea how to fix?


  • Moderators

    @ouzan To run your app outside of VS/QtCreator you need to deploy it, see http://doc.qt.io/qt-5/windows-deployment.html



  • Actually not. I've been able to run in such a way many times before (for example on 64-bit Windows 8.1). Anyway, following the instructions causes the same result. The .exe loads all the needed dll files but some of them have wrong version (32-bit, 64-bit).

    Thanks for your quick answer.


  • Qt Champions 2016

    @ouzan

    Hi
    Running WITHOUT a deployment folder is not supported.

    Sometimes it works due to Qt being in path or some random
    other app that has the Qt dlls and your app loads from there.

    So make your self a deployment folder to do this the right way.



  • @mrjj

    Thank you, running windeployqt.exe put all the things needed next to the .exe. Then, I put them into another folder and set this folder as library path in the code using CoreApplication::setLibraryPaths. But it fails. Tried both absolute and relative path. What am I missing?


  • Qt Champions 2016

    @ouzan said in Qt application gives 0xc000007b error:

    CoreApplication::setLibraryPaths

    That is normally not needed unless its very special setup.

    Please have a look here
    http://www.tripleboot.org/?p=138
    (find your compiler)

    Also this tool can be helpful
    http://www.dependencywalker.com/
    Since it will show what dlls get loaded from where.



  • @ouzan Once you've run windeployqt.exe on your files, then they are folder agnostic, i.e. as long as you copy them (including the subfolders like platforms) all together they can be run from any place on your computer.
    And as @mrjj says, using QCoreApplication::setLibraryPaths shouldn't be necessary.



  • @mrjj I've figured out the problem. An application (CMake) installed in my machine has Qt5Core.dll in bin folder which is in PATH variable. My application tries to get it and it is 32-bit!

    Thank you all.


  • Qt Champions 2016

    @ouzan
    Super.
    Yep, that is why just running exe by clicking demands a deployment folder to avoid
    these wonderful surprises :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.