Installing Borland Turbo C DOS Graphics Emulation (graphics.h) under Code::Blocks
(for using graphics.h under DEV-C++ see http://www.uniqueness-template.com/devcpp/)
Michael Main has implemented a BGI empulation graphics library for Windows applications (based on the Borland Turbo C++ DOS graphics library) to be used under MinGW (and therefore Dev-C++ and Code::Blocks) .
Download: The required files are:
Link to graphics library: After opening a Code::Blocks console project which uses graphics.h you need to set up the libraries for the linker.
Project > Build Options > Linker Settings > Other Linker
options add the following
Operation: You can now use <graphics.h>, e.g. try this simple program (from http://www.uniqueness-template.com/devcpp/)
initwindow(400,300); //open a 400x300 graphics window
while(!kbhit()); //wait for user to press a key
closegraph(); //close graphics window