1

I am using Code::Blocks 16.01 for coding in C++ every code runs properly without showing any problem or error. But ever I runs a graphics program it shows a pop-up window with message circle.exe has stopped working(circle.cpp is the name of my program)(had already copied graphics.h ,winbigim.h and libbgi.a and also corrected the line 302 error in graphics.h and had also had done the linking work).

code that i am using is:-

//circle.cpp 
#include <graphics.h>

int main()
{
 int gd=DETECT,gm;
 initgraph(&gd,&gm," ");
 circle(100,100,50);
 getch();
 closegraph();
 return 0;
}

it shows a pop-up window with message circle.exe has stopped working.

But when ever I run the same code in Turbo C++ it runs without any problem/error.

What should I do?

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • Both Turbo C++ and the "graphics" library are old remnants of old DOS. There's really no support for either on modern Windows systems. Try using some DOS emulator? Or learn modern C++ using a modern [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment)? – Some programmer dude Jun 18 '17 at 12:04
  • Which BGI implementation are you using, [`SDL_bgi`](http://libxbgi.sourceforge.net/)? – genpfault Jun 21 '17 at 16:30

1 Answers1

-1

It is because the BGI graphics expect powers that modern systems don't give out willy-nilly anymore.

To use the old library, your options are:

(1) Run your program in DosBox, and x86 emulator Dos Box

The other option are to get a modern graphics library, like SDL(It's better way and I suggest you).

mshomali
  • 664
  • 1
  • 8
  • 27