Executable terminates immediately in CMD and Powershell

  • Hello,
    I've written a really small programm based on statically linked QT. The programm compiles and starts on Linux, Solaris and AIX (QT4.8.7) from a terminal and runs as expected. On Windows (QT 5.10.1), I can start the programm from QT Creator 4.4 in release and debug mode. But when I try to run the executable directly from CMD or Powershell it terminates immediately without anything written to stdout or any popup window errors. Except for QT I'm also using IBM MQ's API which is dynamically linked. The path to MQ's dlls is set in the PATH variable.
    I've tried to google for simmilar problems and found hints like: dumpbin.exe and PS > Start-Process -PassThru myapp.exe | Get-Process -Module .
    But none show any hints like missing dlls or anything. I also tried to run the exe from the "QT cmd" window but with the same result. I'm relatively sure that this is just an environment issue. But can't findout where the bug hides. Any suggestion appreciated.

    Kind Regards,

  • @Crashdog
    You cannot run app directly from build location.
    For your testing, not the solution, copy your executable in c > qt > version > bin folder and try to run from bin folder itself.

    Please go through below link for more details about deployment process for windows.

  • Hello,
    thak you for your input. However I already know the windows-deployment page. Read it now again to see if I missed anything. Your statement that an app can't run from the build localtion is plain wrong. I made a simple hello world cmd application and I can start it from the build directory. Copying the binary to the QT bin folder does not change the behaviour.

    I guess my next step will be to try the dependency walker. Hope I can download it and use it in my organizations infrastructure.

    Kind Regards,


  • Qt Champions 2017

    If the app is statically linked (with Qt),
    then it seems its MQ's dlls or a dependency thereof its missing.
    dependency walker seems like a good plan.

  • The application appears to run now. However interessting is the fact that it seames to "deamonize" when exec(); is called. Means the cmd does not block but returns. (Unlike Unix where the terminal blocks until the process terminates). The process remains running and since I set the path correctly to MQ's ddls, it even does what it should. The documentation on exec() http://doc.qt.io/qt-5/qapplication.html#exec is not clearing it to me whether the beahaviour, that the cmd is not blocking on Windows, is correct or not.

    Kind Regards,


Log in to reply

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