-1

I'm currently developing a gui application in turbo c++ (mandatory) for a project using C language, and i need to invoke turbo c++'s compiler(gcc), my question is HOW DO I CALL IT? i can't find any sources in the internet regarding this.

here's a snippet of my code

int program(){
 int opt=-1,j;
 char menu[4][20]={"Open File","Compile", "Run","Quit"};
 close=1;
 dropmenu(menu,10,33,131,105,opt);
 do{
  showmouse();
  getmousepos(&buttonm,&xm,&ym);  
  if(xm>=10+10&&xm<=131-10&&ym>=33+8&&ym<=105-8&&buttonm==1){
   for(j=0;j<(105-33-8)/14;j++)
    if((ym-33-8)/14==j){
     opt=j;
     break;
    }
   dropmenu(menu,10,33,131,105,opt);
   switch(opt){
    case 0: openFile(); break;
    case 1: compile(); break;
    case 2: run(); break;
    case 3: delay(100);cleardevice();closegraph();exit(0);
   }
  }else if(xm>=10&&xm<=34&&ym>=18&&ym<=32&&buttonm==1){
   dropmenu(menu,10,33,131,105,opt);
   continue;
  }else if(buttonm==1){
   break;
  }
 }while(close);
 return 0;
}
void openFile() {

}
void compile() {
//i would like to put that invoking here
}
void run() {

}
genpfault
  • 51,148
  • 11
  • 85
  • 139
jyves
  • 1
  • 1
  • 2
    *"i need to invoke turbo c's compiler(gcc)"* Um.... I don't think [`gcc`](https://en.wikipedia.org/wiki/GNU_Compiler_Collection) is Turbo-C's compiler. Back in the day, when I used Turbo-C (we're talking late 80s early 90s here), the compiler was `tc`. – T.J. Crowder Oct 04 '17 at 15:01
  • oh my bad, what I mean is Turbo c++ v3.2 (already edited my question) is there anyway that it's invoking process is possible? – jyves Oct 04 '17 at 15:06
  • @T.J.Crowder oh my bad, what I mean is Turbo c++ v3.2 (already edited my question) is there anyway that it's invoking process is possible? – jyves Oct 04 '17 at 15:10

1 Answers1

0

Firstly gcc is not equivalent to turbo-c. turbo uses tc for compiling the codes. You can probably find that from the documentations of turbo c. To compile a file you can use system function. This function helps to execute command on the turbo c shell. I am not sure gcc would be accessible from the turbo shell. Since turbo elevates(mount) the directories giving it restricted permissions only. Also if you want to use the system it would be like following:

system("tc source.c -o destination");

    or 

system("gcc source.c -o  destination");

remember the above code also shows error if any in the text mode only therefore you might want to redirect them to some file. You can find out about redirecting of output of command line from google. There are many resources about it.