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. Executable terminates immediately in CMD and Powershell

Executable terminates immediately in CMD and Powershell

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.1k Views
  • 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.
  • C Offline
    C Offline
    Crashdog
    wrote on last edited by
    #1

    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,
    Gerhard

    T 1 Reply Last reply
    0
    • C Crashdog

      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,
      Gerhard

      T Offline
      T Offline
      Tirupathi Korla
      wrote on last edited by
      #2

      @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.
      http://doc.qt.io/qt-5/windows-deployment.html

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Crashdog
        wrote on last edited by
        #3

        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,

        Gerhard

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

          Hi
          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.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Crashdog
            wrote on last edited by
            #5

            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,

            Gerhard

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved