How To Add Graphics In Dev C++

July 26, 2022
Let’s find out How to Add Graphics in dev C++

A graphic library is a program library used to display to code written in a programming language in a visual form such as shapes and animations. There are mandatory steps that you should follow to add the graphics library in the dev C++.

This guide will show you How to Add Graphics in dev C++

How To Add Graphics In Dev C++

Step 1: Download/Update the latest version of dev C++

Make sure to have the latest version of the dev C++ application because you will get all the latest features and a lesser number of bugs.

The current latest version of Dev C++ is 6.30, but you can check your version by selecting “help” from the top menu and search “About Dev C++”.

Step 2: Add header source files

You have to download graphics library files and add them to the appropriate folders under the MinGW64 directory.

First of all download header files and extract the files. You will need three files “graphics.h, winbgim.h, and libbgi.a”.

Next step is to copy “graphics.h” and “winbgim.h” into include directory of Dev-Cpp program resource files. Follow the directory address below:

  • C: \Program Files (x86)\Dev-Cpp\MinGW64\include

The third file “libbgi.a”, copy to lib folder which should be inside MinGW64. Follow the directory address below:

  • C: \Program Files (x86)\Dev-Cpp\MinGW64\lib

Check the include and lib folders have these files to proceed to the next step.

Step 3: Change compiler suit in Dev C++

  • Open Dev C++ application
  • At the right side of the toolbar, drop down the menu and select desired compiler suit:

TDM  –  GCC  4.9.2  32-bit  release

Step 4: Configure required linkers for graphics

With this step, the program will link object modules of a program into a single object file. For the “graphics.h” setup, you will need to set the linkers as:

  • TDM  GCC  4.9.2  32-bit  release

Follow the steps below to configure graphics.h linkers:

  • Open Dev C++ and go to the Tool option on the top of the menu bar.
  • Click on Tools and select Compiler Options
  • At the general tab, ensure “Add the following commands when calling the linker” check box is selected.
  • Add the linkers in the input box:

-libgcc -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32

  • Once you copy and paste the linkers, just press OK to save.

Once these steps are done, you will be able to use graphics.h header in your C or C++ programs.