0

I already have graphics.h(and relevant files in MinGW ) but the programs are not working, because after build and run, I get required text output on output window but not the corresponding graphics because program_name.exe stops working. I already have searched all over the internet, StackOverflow is my final hope. I have been doing competitive programming in c+ +, just tried to get into graphics with c++ in code blocks.

#include <graphics.h>
#include <iostream>
using namespace std;
int main()
{  cout<<"a";
int gd= DETECT,gm ;
char driver[] = "";
initgraph(&gd, &gm, driver);
//initgraph(&gd,&gm," ");
circle (100,100,100) ;
getch();
closegraph();
return 0;
}
genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 1
    This looks like you try to use [BGI lib](https://en.wikipedia.org/wiki/Borland_Graphics_Interface) which is _really_ old. Couldn't you use something modern? E.g. [tag:qt] is up to date, portable, and open source, not to mention the active community which provides a lot of sources in case of issues. – Scheff's Cat Dec 22 '18 at 09:57
  • Possibly duplicates with https://stackoverflow.com/questions/7860569/how-i-can-get-and-use-the-header-file-graphics-h-in-my-c-program – dontpanic Dec 22 '18 at 11:05

1 Answers1

1

This is VERY retro. In order for this to even come CLOSE to working you will need to create an MSDOS virtual machine under something like VirtualBox, install DOS 6.2 or similar, install the Borland BGI, Borland C++ 5.02 and then you MIGHT get it to work. Failing that, you could just find an old IBM PC and install DOS on it along with everything else above. Have fun!

Dave Black
  • 65
  • 8