简体   繁体   中英

circle.exe Stopped working while using graphics.h in codeblocks

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?

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM