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 : "Unknown error" when exitCode() != 0
Forum Updated to NodeBB v4.3 + New Features

QProcess : "Unknown error" when exitCode() != 0

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 3 Posters 7.7k Views 1 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.
  • J Offline
    J Offline
    Julie
    wrote on last edited by Julie
    #1

    Hello everyone,

    I develop an application with Qt Creator 4.4.0 (based on Qt 5.9.1) (MVC 2015, 32 bit). I'm on windows 10 x64 and my application is in C++.

    This is part of my main function :

    void fenetreprincipale::on_boutton_ValiderParametres_clicked(){
            argumentsROI = ajoutDesArguments();
    
            if(ui->matrice->isChecked()){
                    argumentsROI.append("--return_matrix");
            }
            else if(ui->check_seuil->isChecked()){
                    argumentsROI.append("--threshold="+seuil);
            }
    
            if(lancementDuProgrammeROI()){
                    if(processusROI.exitCode() == 0){
                            /*TO DO*/
                    }
                    else if(processusROI.error() != 0){
                            QMessageBox::warning(this, "Erreur", "Le programme roi a planté.\n"+statutDeLApplication.number(processusROI.exitStatus())+" : "+processusROI.errorString());
                    }
            }
    

    now this is a function i use :

    QStringList fenetreprincipale::ajoutDesArguments(){
        arguments.clear();
        arguments.append("--file="+nomDuFichierSelectionne);
        arguments.append("--dset="+nomDuJeuDeDonne);
        arguments.append("--CCD_variance="+variance);
        arguments.append("--CCD_gain="+gain);
    
        return arguments;
    }
    
    bool fenetreprincipale::lancementDuProgrammeROI(){
        processusOK = true;
        processusROI.setProgram(nomDuProgrammeROI);
        processusROI.setArguments(argumentsROI);
        processusROI.start();
    
        if(!processusROI.waitForStarted()){
            processusOK = false;
            QMessageBox::warning(this, "Erreur", "Le processus roi n'a pas démarré.\n"+processusROI.errorString());
        }
        else  if(!processusROI.waitForFinished()){
            processusOK = false;
            QMessageBox::warning(this, "Erreur", "Le processus roi ne c'est pas terminé.\n"+processusROI.errorString());
        }
        return processusOK;
    }
    

    here is my class fenetrePrincipale.h :

    #ifndef FENETREPRINCIPALE_H
    #define FENETREPRINCIPALE_H
    
    #include <QMainWindow>
    #include <QFileDialog>
    #include <QMessageBox>
    #include <QDir>
    #include <QProcess>
    
    namespace Ui {
        class fenetreprincipale;
    }
    
    class fenetreprincipale : public QMainWindow{
        Q_OBJECT
    
    public:
        explicit fenetreprincipale(QWidget *parent = 0);
        ~fenetreprincipale();
    
    private slots:
        void on_boutton_ParcourirFichier_clicked();
        void on_boutton_ValiderParametres_clicked();
    
    private:
        Ui::fenetreprincipale *ui;
    
        /*--on_boutton_ValiderParametres_clicked()--*/
        QStringList argumentsROI;
        QStringList ajoutDesArguments();
        bool lancementDuProgrammeROI();
    
        /*--creationDUnDossierContenantLesResultat()--*/
        QString nomDuFichier_clone;
        QString nomDuDossierDesResultats;
        QDir dossierDesResultats;
    
        /*--recuperationDesArguments()--*/
        QString nomDuJeuDeDonne;
        QString variance;
        QString seuil;
        QString gain;
    
        /*--ajoutDesArguments()--*/
        QStringList arguments;
    
        /*--lancementDuProgrammeROI()--*/
        bool processusOK;
        QProcess processusROI;
        QString nomDuProgrammeROI = "roi.exe";
    };
    
    #endif // FENETREPRINCIPALE_H
    

    My working directory are :
    C:\Users\lita6\Documents\Stage\build-ProjetStage-Desktop_Qt_5_9_1_MinGW_32bit-Release

    I don't understant why my program return :

    0 : unknown error
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Julie said in QProcess : "Unknown error" when exitCode() != 0:

      roi.exe

      Is that an Qt exe you call from another qt program?

      J 1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        It is not a error at all. Is it creating process ? Which line the code is giving error ?

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        J 1 Reply Last reply
        0
        • mrjjM mrjj

          @Julie said in QProcess : "Unknown error" when exitCode() != 0:

          roi.exe

          Is that an Qt exe you call from another qt program?

          J Offline
          J Offline
          Julie
          wrote on last edited by
          #4

          hi @mrjj, it's a c program compile with cygwin.

          1 Reply Last reply
          0
          • dheerendraD dheerendra

            It is not a error at all. Is it creating process ? Which line the code is giving error ?

            J Offline
            J Offline
            Julie
            wrote on last edited by
            #5

            hi @dheerendra ,
            When i compile my program there are no error it's only my QMessageBox in main.

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

              @Julie said in QProcess : "Unknown error" when exitCode() != 0:

              cygwin

              Does it depend on any external dlls ?

              Also, if you run roi.exe in a cmd with same parameters, it does work?

              J 1 Reply Last reply
              0
              • mrjjM mrjj

                @Julie said in QProcess : "Unknown error" when exitCode() != 0:

                cygwin

                Does it depend on any external dlls ?

                Also, if you run roi.exe in a cmd with same parameters, it does work?

                J Offline
                J Offline
                Julie
                wrote on last edited by
                #7

                @mrjj , I always add dll and yes before new installation of windows it works. (all my project)

                0_1505229936871_1.png

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  Julie
                  wrote on last edited by
                  #8

                  Maybe it's important :

                  now i compile with release but if i compile with debug i've an other problem :

                  0_1505230171549_2.png

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

                    Hi
                    When you run it in Creator it complains about missing platform ?
                    Then you have a patch issue or installation issue.
                    It should not happen as Creator setup where the app gets it Qt dlls from.

                    J 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      Hi
                      When you run it in Creator it complains about missing platform ?
                      Then you have a patch issue or installation issue.
                      It should not happen as Creator setup where the app gets it Qt dlls from.

                      J Offline
                      J Offline
                      Julie
                      wrote on last edited by Julie
                      #10

                      Hi @mrjj

                      sorry i don't understant your advise.

                      Here it's my folder with dll :

                      0_1505301963706_3.png

                      and here my .por file :

                      0_1505302051832_4.png

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

                        Ok, it seems you try to run it OUTSIDE craetor ?
                        in a deployment folder ?

                        if yes, please see this

                        http://www.tripleboot.org/?p=138

                        you need a subfolder called platforms

                        J 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          Ok, it seems you try to run it OUTSIDE craetor ?
                          in a deployment folder ?

                          if yes, please see this

                          http://www.tripleboot.org/?p=138

                          you need a subfolder called platforms

                          J Offline
                          J Offline
                          Julie
                          wrote on last edited by
                          #12

                          @mrjj ,
                          oh no i run it with my IDE Qt creator.
                          But i try to follow your link.

                          mrjjM 1 Reply Last reply
                          0
                          • J Julie

                            @mrjj ,
                            oh no i run it with my IDE Qt creator.
                            But i try to follow your link.

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by mrjj
                            #13

                            @Julie
                            STOP

                            But when run for creator , no Qt dlls should be copied to the build folder.
                            This is not normal.

                            only foreign dlls like opencv and cyg stuff

                            Also u also include dlls with D in the end its for debug, but its a release folder.
                            So i think you somehow made a mess. :)

                            Its very unclear what you are doing.

                            Deplyment folder (the link) is for other computers. Not running via creator

                            You dont need it to run via creator.
                            So since you copied Qt DLLS to build folder, something seems not right for me.

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

                              Hi

                              Please try
                              Select Projects, Run Settings, expand the Run Environment, and modify the PATH variable to include the folders for any extra dlls you need. opencv and cyg*
                              its explained in details in the manual.

                              J 2 Replies Last reply
                              0
                              • mrjjM mrjj

                                Hi

                                Please try
                                Select Projects, Run Settings, expand the Run Environment, and modify the PATH variable to include the folders for any extra dlls you need. opencv and cyg*
                                its explained in details in the manual.

                                J Offline
                                J Offline
                                Julie
                                wrote on last edited by
                                #15

                                @mrjj

                                My computer had a problem and I reinstalled windows.
                                Before my program works but now no.
                                I only make "open project" in new intallation of Qt.

                                For the dll with "d" i know i see it in other topic. I try to change it but it worked less after.

                                I add manually the dll and the .exe under the "build-ProjetStage-Desktop_Qt_5_9_1_MinGW_32bit-Release\release" folder.

                                I read your link

                                mrjjM 1 Reply Last reply
                                0
                                • J Julie

                                  @mrjj

                                  My computer had a problem and I reinstalled windows.
                                  Before my program works but now no.
                                  I only make "open project" in new intallation of Qt.

                                  For the dll with "d" i know i see it in other topic. I try to change it but it worked less after.

                                  I add manually the dll and the .exe under the "build-ProjetStage-Desktop_Qt_5_9_1_MinGW_32bit-Release\release" folder.

                                  I read your link

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  @Julie

                                  ok, i guess it just need some paths then.
                                  if same code used to work.

                                  You really should make new default GUI project and see that runs.
                                  Else something very wrong with your Qt installation.

                                  1 Reply Last reply
                                  0
                                  • mrjjM mrjj

                                    Hi

                                    Please try
                                    Select Projects, Run Settings, expand the Run Environment, and modify the PATH variable to include the folders for any extra dlls you need. opencv and cyg*
                                    its explained in details in the manual.

                                    J Offline
                                    J Offline
                                    Julie
                                    wrote on last edited by
                                    #17

                                    @mrjj If you know a better/clean method I love to know it.

                                    mrjjM 1 Reply Last reply
                                    0
                                    • J Julie

                                      @mrjj If you know a better/clean method I love to know it.

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      @Julie

                                      Well put into the environment creator uses when u press run
                                      Select Projects, Run Settings, expand the Run Environment.
                                      here u can add paths to dlss and they are found when run.

                                      J 1 Reply Last reply
                                      0
                                      • mrjjM mrjj

                                        @Julie

                                        Well put into the environment creator uses when u press run
                                        Select Projects, Run Settings, expand the Run Environment.
                                        here u can add paths to dlss and they are found when run.

                                        J Offline
                                        J Offline
                                        Julie
                                        wrote on last edited by Julie
                                        #19

                                        @mrjj
                                        I create a new project and i add variables after variables and method after method.
                                        For the moment it's works. (but images are'nt visible now ;( )
                                        I'm going to add the first external .exe.
                                        You think i add it with "Select Projects, Run Settings, expand the Run Environment." ?

                                        I really want to say to you thanks for your help.

                                        mrjjM 1 Reply Last reply
                                        0
                                        • J Julie

                                          @mrjj
                                          I create a new project and i add variables after variables and method after method.
                                          For the moment it's works. (but images are'nt visible now ;( )
                                          I'm going to add the first external .exe.
                                          You think i add it with "Select Projects, Run Settings, expand the Run Environment." ?

                                          I really want to say to you thanks for your help.

                                          mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          @Julie

                                          Its hard to say what went bad after you reinstalled windows.
                                          Maybe it had the right paths back then and Creator took them when you installed Qt.
                                          Im not sure about why it stopped working.

                                          • but images are'nt visible now

                                          What images ?

                                          You are very welcome. i hope you get it to run again.

                                          J 1 Reply Last reply
                                          1

                                          • Login

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