I have tried to learn about graphics using codeblocks , and have initialized the graphics header to my library , every graphics code builds and compiles , and shows :
Process returned -1073741819 (0xC0000005) execution time : 2.776 s
Press any key to continue.
but it doesn't show the graphic window. For example I have written a code to show lines, it doesn't show anything.
I tried this code at first, and it showed:
F:\Code blocks\Lab final\Graph.cpp|12|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
Here is the code:
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
int main() {
int gdriver = DETECT, gmode;
int x1 = 200, y1 = 200;
int x2 = 300, y2 = 300;
char driver[] = "";
initgraph(&gdriver, &gmode,driver);
line(x1, y1, x2, y2);
getch();
closegraph();
}
I expected to see the graphics window , but it doesn't show anything .
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).
3).Now install 32 bit version of codeblocks with mingw setup
Download CodeBlocks 32 bit with mingw
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
3Link Of libbgi.a File From Israq ahemad drive
Image that Shows Where To Add libbgi.a path.
#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
After trying a lot of sites I have found one from where downloading the files that can solve that issue , and for anyone that are facing the same problem , you can download the files from here and follow the steps from the read me file , and it will be solved .
And thanks to everyone who tried to help and replied to my question .
User contributions licensed under CC BY-SA 3.0