Step 1 :- Download the latest version of Dev C++ from here and install it on your computer.
Step 2 :- Download the graphics library files from here and extract them. You will get three files: graphics.h, winbgim.h, and libbgi.a.
Step 3 :- Copy graphics.h and winbgim.h to the include folder of Dev C++. The default location is C:\Program Files (x86)\Dev-Cpp\MinGW64\include.
Step 4 :- Copy libbgi.a to the lib folder of Dev C++. The default location is C:\Program Files (x86)\Dev-Cpp\MinGW64\lib.
Step 5 :- Open Dev C++ and go to Tools -> Compiler Options. Select the Parameters tab and check the box for “Add the following commands when calling the linker”.
Step 6 :- In the linker text area, paste the following commands:
-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32. These are the required linkers for graphics.h file.
Step 7 :- Click OK to save the changes and close the window.
Step 8 :- To test if graphics.h file is working, you can create a new project and write a simple program that uses graphics functions. For example:
Copied!
#include<graphics.h>
int main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm,"C:\\TC\\BGI");
circle(200, 200, 100);
getch();
closegraph();
return 0;
}
EXP 1 CGM (Line, Circle, Ellipse)
EXP 2 CGM (Plot a pixel on Screen)
EXP 3 CGM (DDA Algorithm)
EXP 4 CGM (Midpoint Circle generating)
EXP 5 CGM (Ellipse Generating)
EXP 6 CGM (2D Transformation)
EXP 7 CGM (Composite 2D Transformation)
EXP 8 CGM (Cohen Sutherland 2D Line Clipping)
EXP 9 CGM (Sutherland-Hodgeman Polygon Clipping)
EXP 10 CGM (3D Transformation)
EXP 11 CGM (Composite 3D Transformation)
EXP 12 CGM (3D Objects and Scenes)
EXP 13 CGM (Generating Fractal Images)