Hi there, today’s blog will show you, how to use libraries in codeBlocks blissfully
So, to clarify, I will demonstrate one example for you
At this instant, we will use a library called graphics.h
- Download the WinBGIM library from here–>
- Extract the files from .zip file
- Go to windows c drive –>program files(x86)–>codeblocks–>mingw–> include
- C:\Program Files (x86)\CodeBlocks\MinGW\include
- At this instant copy both header files of library(graphics, winbgim) and paste it in “include folder”
- Press back button you will find “lib folder”
- Open “lib folder” copy the third file of library(libbgi.a) and paste it in “lib folder”
- C:\Program Files (x86)\CodeBlocks\MinGW\lib
- Open codeblock ide–>click settings–>compiler–>linker settings–>Add –>to select the path again go to “lib folder” and select file (libbgia) –> ok
- Paste this code on other linker option’s –>-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32

- Run a simple program to test whether graphics.h library is working or not
//#include <iostream>
#include<graphics.h>
using namespace std;
int main()
{
initwindow(1000,600);
line(200,210,700,410);
getch();
return 0;
}
- Output

Leave a Reply