Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Run Executable File that Obtained from Makeing Project With Command(QProcess) in QT



  • Hi.
    I just want to run an external qt project with commands in qt.
    I tried with QProcess.
    I used start method to run qmake & make.I worked well and made that exe file.
    but I couldn't run my exe file with the start method.I tried startDetached also.I couldn't success.

    This is What I did :

    Command = "qmake";
    args<<"window_qmake.pro";
    
    myProcess.start(Command);
    myProcess.waitForFinished();
    
    //**
    
    Command = "qmake";
    
    myProcess.start(Command);
    myProcess.waitForFinished();
    
    //**
    
    Command = "make clean";
    myProcess.start(Command);
    myProcess.waitForFinished();
    
    //**
    
    Command = "make";
    myProcess.start(Command);
    myProcess.waitForFinished();
    
    //**
    
    Command = "./";
    args<<"window_qmake";
    //myProcess.startDetached("window_qmake");
    myProcess.start(Command,args);
    myProcess.waitForFinished();
    

    Is there anyone who can help me with that?
    Thank You



  • @KIMIA
    In the final case where you want to run your executable you need to set your Command to that. I don't know why you currently have Command = "./"; but that's not going to work. You want something more like:

    Command = "./window_qmake.exe"; // or whatever is necessary as the path to your .exe file
    myProcess.start(Command);
    

    You only need to set up and pass in any args if your want to pass any command-line parameters to your .exe.



  • @JonB
    Ohh,You're right.
    I made a mistake.
    You are Great.
    Thank you so much.