Seems like your problem is arising from calls to system
function, which runs with console window by default. If you need at least one console window for your own programm, this example will help you. If you don't need any output, just uncomment the line in the example.
#include <iostream>
#include <Windows.h>
int main() {
// Uncomment next line if you don't need output at all
// FreeConsole();
std::cout << "Recompiling compile app...";
WinExec("taskkill /IM Compile.exe", SW_HIDE);
WinExec("g++ Compile.cpp -o Compile.exe", SW_HIDE);
WinExec("C:\\Path\\To\\Compile.exe", SW_HIDE);
return 0;
}
You can combine it with my old answer to achieve desired result.
Old answer (still might be helpful for someone);
This question had been answered here and here already, assuming you are talking about compiling C++
app for Windows.
Basically first answer will help you to compile windowed application without a window, and the second one is a console app which will immediately hide the console window, though it will flash on the screen for a second or so.