Dev C++ requires graphics.h header file to enable graphics on computers. Graphics is outdated, and as it was 20+ years back. Modern computers that run 64-bit don’t support it anymore.
In the MS-DOS period, it was a popular library and used by various applications. Even those who are a novice in graphics could gain knowledge from the graphics.h library. It also provides the basis of modern graphics.
There are more complicated but more efficient libraries available than graphics.h. Just to name a few
If you’re having trouble creating graphic elements in development C++, this tutorial will detail How do I Add Graphics in Dev C++?
How do I Add Graphics in Dev C++ (Follow These Steps)
- Download/update the most current version of development C+
- Insert the header source files to Dev Cthe ++ directory
- Switch the compiler’s suitability for Dev C+.
- Set up the required linkers for graphics
- Check whether the graphics.h header is in operation (optional)
Step 1: Download/update most recent version of C++ dev C+
It’s recommended to download the most recent version Dev C++ application. With the latest version, you will likely get more features and fewer bugs and security patches.
You can download the most recent version of development C++. I’m running version 5.11 for this post. You may receive an upgrade, but the process stays the same. You can verify your Dev Cversion by clicking “help” on the menu on top and then clicking ” About Dev C+.”
Step 2: Upload header source files to the Dev C directory
Then, you must download the graphics library files and upload them to the correct folders within the “MinGW64” directory. Follow this procedure –
- Download the header files using the Google download URL and extract the header files.
- It contains three files: graphics.h, winbgim.h and libbgi.a.
- It is necessary to duplicate “graphics.h” and “winbgim.h” into the included directory for Dev-Cpp Resource files for the program. The exact address of the directory is the following:
- C:\Program Files (x86)\Dev-Cpp\MinGW64\include
- Then, Copy “libbgi. a” to Libre. The folder should be within the MinGW64. The directory address is —
- C:\Program Files (x86)\Dev-Cpp\MinGW64\lib
Check the Include and check the Include and folders for these files before proceeding to the next step.
Step 3: Reset your compiler to match Dev C+.
Compiler packages combine the most current stable version of the GCC toolset with the MinGW’s runtime APIs that are open source to create an open-source substitute for Microsoft’s compiler. It is essential to adjust the TDM — GCC Version to the 4.9.2 32-bit version.
- The first time you open the Dev C++ application.
- To the right of the toolbar, you’ll be able to use the drop-down menus to choose the compiler you want.
- Make it TDM- GCC 4.9.2 32 bit release.
Step 4: Set up the required linkers to graphics
Setting up linkers is an essential procedure, as this program can help connect objects of a program to a single object file. To use graphics.h setup, you’ll require these linkers to be configured to the compiler suite you have selected, also known as TDM or GCC 4.9.2 32 bit release.
How to set up graphics.h linkers:
- If you’re using Dev C++, look for the Tool option in the top menu.
- Extend the tools and choose the Compiler options.
- You’ll need to go to the general tab of the compiler options window.
- Ensure that the ” Add the following commands when you call”linker” checkbox is checked.
- Add these linkers to the input box (just duplicate and copy this text)
- -libgcc -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
- Then click OK to save.
Once you have completed the course, you will be able to implement the graphics.h header in your C or C++ applications.
Step 5: Check if the graphics.h header is functioning (optional)
Create a Source file. Write a script to test the graphics.h header. You can experiment with any feature you like, such as printing GANA (in the Hindi language) with basic graphic output and techniques…
#include #include #include #include main()
Here’s the output:
Is it still not possible to include graphics in Dev C++?
Eventually, following this guide will ensure that your graphics.h header works in conjunction with its Dev C++ application. If you’ve not followed the procedure thoroughly, you could end up the steps being skipped… and if it’s not working, it’s best to uninstall any earlier versions or versions of Dev C++ and ensure you are running the most recent version. You can follow these steps over and over again.