I am trying to write a game similar to code hunt (http://ift.tt/1TfsEp9) So How this will work, is the player can modify a .cpp file, which will be compiled and and ran within the code, but I have problems about how to compile it. I'am using the latest g++ compiler, and this is how I try to achive this:
void Builder::build(const char* file){
std::string s = "g++ ";
s += file;
s += " -o test.o";
system(s.c_str());
}
Where we get the .cpp file's name, and this code piece is supposed to build test.o This is just a test now, it might get more complex, I just wanted to test if the compiler will work within the code, but I get this error message when I try to run this:
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../libmingw32.a(main.o):(.text.startup+0xa7):undefined reference to 'WinMain@16'
collect2.exe: error: ld returned 1 exit status
PATH for mingw is set correctly, I checked. I am using Windows 8.1, g++ 4.9.3 and Code::Blocks.
Aucun commentaire:
Enregistrer un commentaire