#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>

void main (int)
{
int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection.
int midx,midy,x;
//Initializing graphics and local variables.
initgraph(&gdriver,&gmode,"d:\\bc3\\bgi");
//Reading result of initialization.
errorcode=graphresult();
if(errorcode!=grOk)
//An error occurred.
{
printf("Graphics error occurred : %s \n",grapherrormsg(errorcode));
printf("Press any key to stop : ");
getch();
exit(1); //Terminate the program due to error.
}
/*Changing the foreground color.
Note : Press enter to exit the last screen as it is black and
it may appear as if the program has stopped running.*/
for(x=15;x>=0;x--)
{
setcolor(x);
circle(20+(x*40),200,15);/*Changing x-coordinate by 50 each time so that
the circles do not overlap.*/
getch();
}
cleardevice(); //Clearing the screen in the graphics mode.
circle(200,200,50);
getch();
closegraph();
}

i have one erorr
fatal error C1083: Cannot open include file: 'graphics.h': No such file or directory
Error executing cl.exe.

please help

Recommended Answers

All 9 Replies

Looks like you dont have it given by the Visual C++ Compiler. Some old versions of Borland had it. But I dont think not now.

graphics.h was non-standard 16-bit Borland compiler specific. M$ compilers never supported it. You will probably have to download free copy of Turco C to compile that program.

thanks you mean that i can not use this library
would you give me another one please

thanks you mean that i can not use this library
would you give me another one please

The days of directly accressing windows memory are gone! For MS-Windows, there is OpenGL which I think is free, DirectX and DirectDraw, both free from Microsoft. All are very complex libraries.

you can also call win32 api functions to draw graphics. I think you can find several tutorials if you google for them.

There is also QT, which is a os-independent way of going graphics. Free for home use, but not free for commercial use.

sorry but i do not know how to make what you say
i want this program to design my program which written in c++ language

sorry but i do not know how to make what you say
i want this program to design my program which written in c++ language

everything I mentioned can be used by C++. Its just that they are all somewhat difficult to use and will require a solid understanding of c++ language, not really intended for newbes :rolleyes: Afterall you can't play a Beethovan's Concertos if you know nothing about music, so what makes you think you can write complicated graphics programs with no (or little) knowledge of a programming language?

thanks for encarge me however i am just a biggener am not aprofissional i try hard to teach my self
any way thank you very very much :confused:

#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>

void main (int)
{
int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection.
int midx,midy,x;
//Initializing graphics and local variables.
initgraph(&gdriver,&gmode,"d:\\bc3\\bgi");
//Reading result of initialization.
errorcode=graphresult();
if(errorcode!=grOk)
//An error occurred.
{
printf("Graphics error occurred : %s \n",grapherrormsg(errorcode));
printf("Press any key to stop : ");
getch();
exit(1); //Terminate the program due to error.
}
/*Changing the foreground color.
Note : Press enter to exit the last screen as it is black and
it may appear as if the program has stopped running.*/
for(x=15;x>=0;x--)
{
setcolor(x);
circle(20+(x*40),200,15);/*Changing x-coordinate by 50 each time so that
the circles do not overlap.*/
getch();
}
cleardevice(); //Clearing the screen in the graphics mode.
circle(200,200,50);
getch();
closegraph();
}

i have one erorr
fatal error C1083: Cannot open include file: 'graphics.h': No such file or directory
Error executing cl.exe.

please help

how can we remove the error-no such file or directory for graphics.h.plz help me

commented: Start your own thread. -1

how can we remove fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory plse help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.