p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C++ Programming (http://p2p.wrox.com/forumdisplay.php?f=89)
-   -   graphics in C++ (http://p2p.wrox.com/showthread.php?t=32152)

MASTER_1st August 4th, 2005 07:01 AM

graphics in C++
I have problem connected with activete library (graphics.h)
under rhide (compilator C++). I set in motion programm with
help and are problems (BGI graphics not ANSI compatible) and
not identifity functions contents in this library. My programm:

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

int main(void)
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int xmax, ymax;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   /* an error occurred */
   if (errorcode != grOk)
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");

   xmax = getmaxx();
   ymax = getmaxy();

   /* draw a diagonal line */
   line(0, 0, xmax, ymax);

   /* clean up */
   return 0;
(*)Where is error?

Paramesh November 6th, 2005 09:10 PM

Your error message itself says this:
"BGI graphics not ANSI compatible"

The graphics you used is not a standard C/c++ code. It is not ANSI or ISO code.

You can try compiling it in Turbo C++ instead.


"Don't walk behind me; I may not lead.
 Don't walk in front of me; I may not follow.
 Just walk beside me and be my friend."

vector November 28th, 2005 12:02 AM

you should need to specify the default path or path where egavga.bgi file exist...for example

initgraph(&gdriver, &gmode, "\\tc\\bgi");

All times are GMT -4. The time now is 05:11 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.