Help me Please....I can't run #include...It can not detect it. I can not run any graphics function?
Jay
2009-04-18 14:35:45 UTC
I think i do not have a graphics library...
If you have please send me any perfect URL or files via mail...
Three answers:
Ragz
2009-04-18 14:42:46 UTC
If you are using latest C++ then u wont have graphics library.
Ciaron
2009-04-18 21:52:32 UTC
You will be using Borland C++ what you need to do is either have the path for the bgi file - the standard is egavga.bgi and it is in the directory bc5\bgi this contains the graphic modes files with the BGI Extension, it is a Dos mode function so if you are using Borland C++ Version 4.02 to 5.02 - you have to have the project as a Dos mode in the target option. That is if you get the bgi graphics not supported error message. If you get the can't initialize graphics the program can't find the files
Here's a couple examples that might help if you save them in the directory c:\bc5\bgi
/*A program to draw a space with stars*/
#include
void main()
{
int gd=DETECT,gm;
int i,x,y;
initgraph(&gd,&gm,"");
line(0,0,640,0);
line(0,0,0,480);
line(639,0,639,480);
line(639,479,0,479);
for(i=0;i<=1000;i++)
{
x=rand()%639;
y=rand()%480;
putpixel(x,y,15);
}
getch();
closegraph();
}
/* End of program */
and this one
/*Here a sample program to illustrate how to use BARS which are used for visual statistics */
#include
main() {
int gd=DETECT,gm,maxx,maxy,x,y,button;
initgraph(&gd,&gm,"");
line(80,150,200,150);
line(80,150,80,50);
settextstyle(1,HORIZ_DIR,1);
outtextxy(100,153,"<-X axis");
settextstyle(1,VERT_DIR,1);
outtextxy(60,50,"<-Y axis");
bar(100,100,120,150);
bar(130,120,150,150);
getch();
closegraph();
}
these should work.
?
2009-04-19 01:12:28 UTC
I can understand what exactly the problem is... dont worry i too had the same problem in the beginning and i solved it... Here is how :(Grahics library is usually available but it must be enabled before use)
In the TurboC++ editor, goto menu : Options->Linker->Libraries and check the 'Graphics library' option... Usually it is unchecked...
I am sure this would solve your problem.. keep going...
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.