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. QProcess unexpectedly finished
Forum Updated to NodeBB v4.3 + New Features

QProcess unexpectedly finished

Scheduled Pinned Locked Moved Solved General and Desktop
30 Posts 4 Posters 3.5k Views 2 Watching
  • 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.
  • sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by
    #6

    Go into that build directory, there will be analogclock file in there (it will have executable permissions, easy to spot if you run ls -aGl in the directory, or by looking at icon in some file manager) - that's your binary.

    (Z(:^

    1 Reply Last reply
    0
    • K krist

      I have run the analogClock, but i don't know where the binary file go

      can you please guide me?
      or maybe do you have a refrence video to do it?
      I am very appreciated it

      after i run, there is appear build-analogclock ... debug
      is it the binary file go?
      and inside it, there are 7 file in it

      thank you

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #7

      @krist said in QProcess unexpectedly finished:

      I have run the analogClock, but i don't know where the binary file go

      What does "run" mean? You have to build --- compile & link --- the analogclock project, either for debug or for release. That puts the executable in a directory as specified in the .pro file/look at your Qt Creator settings for building. That is what you need to execute. No, there is no "reference video" for this. It's what building from source code is all about.

      after i run, there is appear build-analogclock ... debug
      is it the binary file go?

      Did you try looking in that directory, for an executable named analogclock?

      From the output you showed earlier:
      Starting /home/krist/qt_proj/build-try_QProcess-Desktop-Debug/try_QProcess ...
      While for your QProcess command you show
      ./krist/QT5.13.2/examples/QT-5.13.2/gui/analogclock
      How are these two paths related? Why have you placed a ./ at the start of that? What is your current directory? I would recommend only using absolute paths, not relative, so you know what is going on.

      1 Reply Last reply
      1
      • K Offline
        K Offline
        krist
        wrote on last edited by
        #8

        thank you for the answers

        Starting /home/krist/qt_proj/build-try_QProcess-Desktop-Debug/try_QProcess ...
        

        is mine project where i make.

        and the QT5.13.2 is where the analogclock file is

        what i mean run is build and run (click on the little hammer in the left below qt and the play icon).

            QProcess *myProcess = new QProcess(this);
             QString program = "/home/krist/Qt5.13.2/examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock";
             QStringList arguments;
             arguments << "-style" << "motif";
             myProcess->start(program, arguments);
        

        I have found the analogclock at file build-analogclock-Desktop ...
        but when i source it like below, nothing happened
        Is there anything wrong?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #9

          Probably the example fails to run because Qt libraries are not found by ldd. You need to set LD_LIBRARY_PATH for it to work.

          To get the actual error messages or warnings coming from QProcess, make sure you connect to errorOccured signal and get all output from stderr.

          (Z(:^

          1 Reply Last reply
          2
          • K Offline
            K Offline
            krist
            wrote on last edited by krist
            #10

            I just realied that every time I build and run there is always a notification like this :

            15:25:54: Starting /home/krist/qt_proj/build-try_qprocess1-Desktop-Debug/try_qprocess1 ...
            15:25:58: The program has unexpectedly finished.
            15:25:58: The process was ended forcefully.
            15:25:58: /home/krist/qt_proj/build-try_qprocess1-Desktop-Debug/try_qprocess1 crashed.
            

            Is it the error that you looking for?

            sierdzioS 1 Reply Last reply
            0
            • K krist

              I just realied that every time I build and run there is always a notification like this :

              15:25:54: Starting /home/krist/qt_proj/build-try_qprocess1-Desktop-Debug/try_qprocess1 ...
              15:25:58: The program has unexpectedly finished.
              15:25:58: The process was ended forcefully.
              15:25:58: /home/krist/qt_proj/build-try_qprocess1-Desktop-Debug/try_qprocess1 crashed.
              

              Is it the error that you looking for?

              sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #11

              @krist said in QProcess unexpectedly finished:

              Is it the error that you looking for?

              It's not me looking for errors here, it's you :-)

              15:25:58: The program has unexpectedly finished.

              No, this tells us nothing. We need more information. Run your app with a debugger (F5), it will show you where the crash occurs.

              (Z(:^

              1 Reply Last reply
              2
              • K Offline
                K Offline
                krist
                wrote on last edited by
                #12

                yeah i know that the big error lies on me
                :(

                here is the picture of debugging
                I have several times click the button but still nothing happens and there is no notification?
                asdsadsd.png image url)

                FYI I'm using linux with QT 5.13.2

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #13

                  You've commented out the on_pushButton_clicked() slot, so it's not crashing.

                  (Z(:^

                  1 Reply Last reply
                  1
                  • K Offline
                    K Offline
                    krist
                    wrote on last edited by
                    #14

                    oh sory
                    I just try some others code earlier

                    here is the right screenshoot

                    mlopr.png

                    JonBJ 1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #15

                      Does it crash when you click the button? The screenshot does not show any crash.

                      (Z(:^

                      1 Reply Last reply
                      1
                      • K krist

                        oh sory
                        I just try some others code earlier

                        here is the right screenshoot

                        mlopr.png

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by JonB
                        #16

                        @krist
                        I can see by enlarging your image that you are still not supplying the correct path for the subprocess. Nor does it even have the executable you wish to run. There is no point telling us here your code contains a certain string if it does not actually use that string. You need to understand the absolute basics about paths if you expect to develop code....

                        Further, you should read the QProcess documentation and e.g. both check return results and errorOccurred slot if you are having trouble running a process and expect to get error status back.

                        1 Reply Last reply
                        1
                        • K Offline
                          K Offline
                          krist
                          wrote on last edited by
                          #17

                          Thank you both for your patience on me
                          :(

                          @JonB
                          I use the path based on projects analogClock
                          here is the screenshot
                          based on what sierdiio said , i need to source my path to the binary file

                          buildanalogclock.png

                          @sierdzio
                          Nothing crash just nothing happens

                          JonBJ J.HilkJ 2 Replies Last reply
                          0
                          • K krist

                            Thank you both for your patience on me
                            :(

                            @JonB
                            I use the path based on projects analogClock
                            here is the screenshot
                            based on what sierdiio said , i need to source my path to the binary file

                            buildanalogclock.png

                            @sierdzio
                            Nothing crash just nothing happens

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by JonB
                            #18

                            @krist said in QProcess unexpectedly finished:

                            I use the path based on projects analogClock

                            No, you don't. The screenshot (of your code running the QProcess) shows a path which is simply incorrect. Whether you've changed that since screenshot I cannot say.

                            1 Reply Last reply
                            1
                            • K krist

                              Thank you both for your patience on me
                              :(

                              @JonB
                              I use the path based on projects analogClock
                              here is the screenshot
                              based on what sierdiio said , i need to source my path to the binary file

                              buildanalogclock.png

                              @sierdzio
                              Nothing crash just nothing happens

                              J.HilkJ Online
                              J.HilkJ Online
                              J.Hilk
                              Moderators
                              wrote on last edited by
                              #19

                              @krist ok, as a step 1, why don't you open a console/terminal outside of QtCreator and try to launch the analogClock manually.

                              Make sure that works, before you try it from inside your own program!


                              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                              Q: What's that?
                              A: It's blue light.
                              Q: What does it do?
                              A: It turns blue.

                              K 1 Reply Last reply
                              3
                              • J.HilkJ J.Hilk

                                @krist ok, as a step 1, why don't you open a console/terminal outside of QtCreator and try to launch the analogClock manually.

                                Make sure that works, before you try it from inside your own program!

                                K Offline
                                K Offline
                                krist
                                wrote on last edited by
                                #20

                                @J-Hilk
                                hello

                                yapps it's runnable
                                the step i use is

                                $cd Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/
                                enter
                                $./analogclock
                                
                                JonBJ 1 Reply Last reply
                                0
                                • K krist

                                  @J-Hilk
                                  hello

                                  yapps it's runnable
                                  the step i use is

                                  $cd Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/
                                  enter
                                  $./analogclock
                                  
                                  JonBJ Offline
                                  JonBJ Offline
                                  JonB
                                  wrote on last edited by JonB
                                  #21

                                  @krist
                                  Then you need to use something in your code which is actually the same as that, not what your screen shot has which is simply not the same!
                                  Hint: /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock.
                                  Which you seem to have had at one point, and then changed to something wrong.

                                  1 Reply Last reply
                                  1
                                  • K Offline
                                    K Offline
                                    krist
                                    wrote on last edited by
                                    #22

                                    yeah i have tried that and error is come up
                                    here is the error

                                    /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.13' not found (required by /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock)
                                    
                                    sierdzioS JonBJ 2 Replies Last reply
                                    0
                                    • K krist

                                      yeah i have tried that and error is come up
                                      here is the error

                                      /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.13' not found (required by /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock)
                                      
                                      sierdzioS Offline
                                      sierdzioS Offline
                                      sierdzio
                                      Moderators
                                      wrote on last edited by
                                      #23

                                      @krist said in QProcess unexpectedly finished:

                                      yeah i have tried that and error is come up
                                      here is the error

                                      /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.13' not found (required by /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock)
                                      

                                      That's where LD_LIBRARY_PATH comes in ;-) You can set it with https://doc.qt.io/qt-5/qprocess.html#setProcessEnvironment

                                      (Z(:^

                                      K 1 Reply Last reply
                                      4
                                      • K krist

                                        yeah i have tried that and error is come up
                                        here is the error

                                        /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.13' not found (required by /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock)
                                        
                                        JonBJ Offline
                                        JonBJ Offline
                                        JonB
                                        wrote on last edited by JonB
                                        #24

                                        @krist
                                        OK, let's start from there! That path is correct, so let's not change off that!

                                        Now you have some issue of not finding the correct Qt version.

                                        Are you Linux? Did you build your own Qt, or did you accept the one supplied with the distro? Have you installed more than one version of Qt at some point?

                                        Ah, I see @sierdzio is pointing you at what you can look at.... I will leave you in his capable hands :)

                                        1 Reply Last reply
                                        2
                                        • sierdzioS sierdzio

                                          @krist said in QProcess unexpectedly finished:

                                          yeah i have tried that and error is come up
                                          here is the error

                                          /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.13' not found (required by /home/krist/Qt5.13.2/Examples/Qt-5.13.2/gui/build-analogclock-Desktop_Qt_5_13_2_GCC_64bit-Debug/analogclock)
                                          

                                          That's where LD_LIBRARY_PATH comes in ;-) You can set it with https://doc.qt.io/qt-5/qprocess.html#setProcessEnvironment

                                          K Offline
                                          K Offline
                                          krist
                                          wrote on last edited by
                                          #25

                                          @sierdzio
                                          ok
                                          so right now the problem lies on my install qt right?
                                          where should i source that environment?
                                          is it to my workable analogclock?

                                          env.insert("TMPDIR", "C:\\MyApp\\temp"); // Add an environment variable
                                          

                                          @JonB
                                          yeah i'm using linux and have 2 qt (one with ros plugin and the others only for qt)
                                          tahnk you so much for your help!!!

                                          sierdzioS 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