I want to compile a C code from c# programmatically. I am trying but i have not found any solution yet. Here is my code.
try {
var info = new ProcessStartInfo {
FileName = "cmd.exe",
Arguments = "mingw32-gcc -o a Test.c"
};
var process = new Process { StartInfo = info };
bool start = process.Start();
process.WaitForExit();
if (start) {
Console.WriteLine("done");
}
} catch (Exception) {
Console.WriteLine("Not done");
}
I am using VS2010 in windows 7 and I have installed mingw32-gcc and my environment variable for mingw32-gcc is C:\Program Files\CodeBlocks\MinGW\bin Any Help will be appreciated. Thanks in advance.
Filenameset to the actual path of mingw32-gcc.exe, no need to callcmd.exe? Make sure to include ".exe".