Since they are (presumably) std::string
, you can just paste them together with +
, like this:
std::string cmd = "/MinGW/bin/g++.exe";
std::string fullcmd = cmd + " " + input + " -o " + output;
system(fullcmd.c_str());
You need fullcmd.c_str()
since system
takes a C style string, not a C++ style string.