- if you have tried a lot and not getting how to completely setup graphics in code block then you are at right place.
1).First delete your codeblock
2).Then install mingw-get-setup (32 bit) and setup it using any youtube video. If you have already installed it than it's fine. You can skip this step.
You can Use following link to download mingw(avoid if you already have it).
Mingw-get-setup Download
3).Now install 32 bit version of codeblocks with mingw setup
Download CodeBlocks 32 bit with mingw
- Now If you are Have Installed Ming-W in you C drive check that Your code block is by default taking compiler path as this c drive's MingW's path otherwise do reset default setting in codeblocks ->settings-compiler-toolchain executable
Image
Then Go In the incude section of that C drive Mingw's include section rather than going in codeblocks mingw's include section
now paste following files
Note:- If You Have Already copied graphics.h and winbgim.h files from other sources Then Also Replace It With Following
Note:- Best way to find include section is go in C drive-Mingw and type iostream in search bar of your file explorer and right click on iostream file and open its location and to find correct lib go back from this include section and click on lib section NOTE:-Location of lib may differ but correct lib is lib section with lot .a files
1 Link Of Graphics.h File From Israq ahemad drive
2 Link Of Winbgi.h File From Israq ahemad drive
- Now Go In that C drive Mingw's Lib section rather than going in codeblock's mingw's lib section and paste following file in that.
3Link Of libbgi.a File From Israq ahemad drive
- Now Go to setting-compiler-linkersetting
and in linkersetting add libbgi.a file location which you have just pasted
and in right side box paste -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
Image that Shows Where To Add libbgi.a path.
- And Now Just Try To Write
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
int main()
{
int gd,gm;
detectgraph(&gd,&gm);
initgraph(&gd,&gm," ");
circle(200,200,100);
getch();
closegraph();
return 0;
}
in file with cpp extention.
And you will get following output
Image that Shows Desired Outputs