Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
help me i am try but error graphic.h no such file or dirctory i am using dev c++
i am try following code
C
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<math.h>
 
union REGS i, o;
 
int initmouse()
{
   i.x.ax = 0;
   int86(0X33, &i, &o);
   return ( o.x.ax );
}
 
void showmouseptr()
{
   i.x.ax = 1;
   int86(0X33, &i, &o);
}
 
void hidemopuseptr()
{
   i.x.ax = 2;
   int86(0X33,&i,&o);
}
 
void getmousepos(int *x, int *y)
{
   i.x.ax = 3;
   int86(0X33, &i, &o);
   *x = o.x.cx;
   *y = o.x.dx;
 
}
 
void movemouseptr(int x, int y)
{
   i.x.ax = 4;
   i.x.cx = x;
   i.x.dx = y;
   int86(0X33, &i, &o);
}
 
main()
{
   int gd = DETECT, gm, midx, midy, radius, x, y, tempx, tempy;
 
   radius = 100;
 
   initgraph(&gd, &gm, "C:\\TC\\BGI");
 
   if(!initmouse())
   {
      closegraph();
      exit(1);
   }
 
   midx = getmaxx()/2;
   midy = getmaxy()/2;
 
   showmouseptr();
   movemouseptr(midx, midy);
   circle(midx, midy, radius);
 
   x = tempx = midx;
   y = tempy = midy;
 
   while(!kbhit())
   {
      getmousepos(&x, &y);
 
      if((pow(x-midx,2)+pow(y-midy,2)-pow(radius,2))>0)
      {
         movemouseptr(tempx, tempy);
         x = tempx;
         y = tempy;
      }
 
      tempx = x;
      tempy = y;
   }
 
   closegraph();
   return 0;
}


What I have tried:

help me i am try but error graphic.h no such file or dirctory i am using dev c++
Posted
Updated 9-Aug-16 23:13pm
v2

Such code uses an ancient compiler that targets DOS. In order to make it work you have to install the compiler (probably in a DOS environment emulator, such DOSBox[^]).

As an alternative (a more rewarding alternative, in my opinion) you could rewrite your code for using Windows API[^] with a modern compiler.
 
Share this answer
 
v2
Quote:
error graphic.h no such file or dirctory

The error message is clear enough !
The only one that can help you is sitting in front of your screen.

Check your source code, it says graphics.h and the error says graphic.h.
 
Share this answer
 
Comments
Malil Developers 10-Aug-16 9:25am    
error say graphics.h when i change header file name graphic.h error is graphic.h no such file or dictory

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900