I have a piece of C ++ code using Qt where I try to run a batch file on the command line. I use the QProcess object to run cmd.exe and execute my batch file. The following is the code I'm using:
void Utility::executeBatchFile(QString batchFile) { QProcess *process = new QProcess(this); QString cmdName = "cmd.exe"; QStringList arguments; arguments<<"/k" << batchFile; process->startDetached(cmdName, arguments); }
When I create it in Qt Creator, I get a warning:
warning: C4189: "process": local variable is initialized but not specified
The process variable is indicated on the last line of the function, and I cannot understand why this warning appears.
source share