You know that Dev C++ is a free integrated development environment (IDE). It is a programing software, and it was developed by Bloodshed software. With Dev C++, you can write Windows or console-based C++ programs quickly.
This blog discusses how you can add Graphics in Dev C++. Because when you add graphics.h header file, it provides graphics capability to computers. At present, 64-bit computers do not support it.
Add graphics in Dev C++ by following these steps:
You can follow the steps carefully and add the graphics in dev C++.
- Download the latest version of dev C++
- Adding graphics header source files in dev C++
- Change compiler suit in dev C++
- Configure graphics linkers
- Check the graphics header is working well
Step 1: Download the latest version of dev C++
Go to the link and download the latest version of the Dev C++ application because the old or outdated version brings some bugs and glitches.
- After completing the download then, install the Dev C++ application.
- If you have already a dec C++ application, then check the version by selecting ‘help’.
- Then select ‘About Dev C++’ and upgrade the application.
Step 2: Adding graphics header source files in dev C++
In the second step, you need to download some header files. After that, add the downloaded files under the MinGW64 directory.
- Download the required files from the internet and then extract the files.
- There are three different files in the file: graphics.h, winbgim.h, and libbgi.a.
- Now, copy the “graphics.h” and “winbgim.h” files into ‘includdirectoryory of dev C++ program files. We provide the directory address.
C:\Program Files (x86)\Dev-Cpp\MinGW64\include
- Now, copy “libbgi.a” file to ‘lib’ folder of dev C++. Check the location.
C:\Program Files (x86)\Dev-Cpp\MinGW64\lib
- Double-click the ‘include’ and ‘lib’ folders in the last step to check.
Step 3: Change compiler suit in dev C++
In this step, you must set the TDM-HCC version to the 4.9.2 32-bit release.
- Open the dev C++ application
- Select the desired compiler suit in the toolbar’s drop-down menu on the right side.
- Now you can set it to TDM – GCC 4.9.2 32-bit release.
Step 4: Configure graphics linkers
In this step, we are configuring the graphics linkers. So check the given steps and configure the graphics.h linkers.
- Open the dev C++ application and select the Tool option on the top menu.
- Now, you can expand the Tool option and choose the Compiler option.
- In the General tab, you can see the “Add the following commands when calling the linker” check box and select the box.
- Now, add the given below linkers in the input box.
-libgcc -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
- After putting the linkers then, click on the OK button to save.
- Now you are ready to use the graphics.h header in your C++ program.
Step 5: Check the graphics header is working well.
The last step is optional for you. You can check whether the graphics header is working or not. To verify the graphics.h header, then you have to create a new source file. In that file, write a program to test graphics.h header. Or you can use the basic graphics output primitives like
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> main() { int gd=DETECT,gm; initgraph(&gd,&gm,"c:\\tc\\bgi"); setbkcolor(9); line(130,100,290,100); line(165,100,165,155); arc(150,155,100,0,15); line(180,100,180,170); line(190,100,190,170); circle(220,140,10); line(220,130,255,130); line(255,100,255,170); line(265,100,265,170); getch(); }
That’s it; We hope you can successfully add Graphics in dev C++.
Leave a Reply