Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

graphics.h not working in code blocks with MinGW in windows 7 64bit

I had setup the graphics file necessary for the execution of the graphics code in CodeBlocks from the following sites:-

http://www.codewithc.com/how-to-include-graphics-h-in-codeblocks

then I tried this sample code.

#include <graphics.h>
int main( )
{
     initwindow(400, 300, "First Sample");
     circle(100, 50, 40);
     while (!kbhit( ))
     {
         delay(200);
     }
     return 0;
}

but when I Run the code in code blocks I get this

draw.exe has stopped working...

output of the program

Can anyone resolve my problem?

like image 440
Anant_infinity Avatar asked Jan 19 '17 11:01

Anant_infinity


1 Answers

This is because graphics.h is Borland's BGI graphics library from 1989, developed for 16 bit MS DOS computers. But you are using a 64 bit Windows computer.

Solution: don't use 28 years old, non-standard libraries.

like image 50
Lundin Avatar answered Oct 20 '22 01:10

Lundin