I want to build in Qt c + + source code, could you tell me how to through the MinGW64 g + +. Exe exit code to determine whether the compile error?
Void MainWindow: : on_compile_clicked ()
{
//the file path
QFile f (UI - & gt; Filename - & gt; The text ());
if (! F.e xists ()) {
//can't find the file
QMessageBox: : warning (this, tr (" Not found "), tr (" File doesn \ 't exist!" ));
return;
}
//generated parameter
QStringList argument=genArgument ();
//select compiler (currently only supports MinGW64)
QString main=". ";
The switch (compiler) {
Case MINGW64: main +="\ \ MINGW64 \ \ bin \ \ g + + exe"; break;
}
//compile
QProcess * process=new QProcess (this);
The process - & gt; SetProgram (main);
The process - & gt; SetArguments (argument);
Connect (process, SIGNAL (finished (int, QProcess: : ExitStatus)), and this, SLOT (CompileFinished (int, QProcess: : ExitStatus)));
The connect (process, SIGNAL (readyRead ()), and this, SLOT (readyRead ()));
The process - & gt; Start ().
}
Void MainWindow: : CompileFinished (int exitcode, QProcess: : ExitStatus status) {
//compile end
}