How to include graphics.h in CodeBlocks

Hello Learners, Today We are going to discuss how to include graphics.h in code blocks.It is basically used when programmers try to run some animations.

Include graphics.h in CodeBlocks

Follow these steps to add graphics.h  file in your program.

Step 1: For adding “graphics.h file”,  first we need to download the winBGIm library. Click the link to download


Step 2:  Extracting the files that we have downloaded using 7zip/WinRAR/ normally on windows 10. It must have 3 files named as ‘graphics’, ‘winbgim’ and ‘libbgi’.

Step 3: Now transfer the ‘graphics’ and ‘winbgim’ file into the include folder and ‘libbgi.a’ to the lib folder by using ctrl C and Ctrl V on windows.

Step 4: Make Changes in settings.  go to Settings and then choose Compiler and then click on  Linker settings.

Step 5: Clicking the Add button of the “Link libraries”  and select the path of ‘libbgi’ file copied into the lib folder.

Step 6: In the right part paste  this command :

”  -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32   “

Step 7: After completing all of these steps you may find there is still an error. Now  Open the path of the graphic.h file presents in the include folder and makes some change. G0 to line number 302 of this script and change the previous line with this :

int left=0, int top=0, int right=INT_MAX, int bottom=INT_MAX,

and then save the respective file.

Leave a Reply

Your email address will not be published. Required fields are marked *