Thread: Graphics.h library problem

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    13

    Graphics.h library problem

    To understand this situation, I'll give a brief account of the history behind this problem:

    Back in December, when I was taking Structured Programming (Pascal...), I was asked by the teacher to help another teacher create a program for his math class, bascially a game of Battleship or Rocket, to try to get the students to use distance formula and whatnot, with the Rocket being with three coordinates instead of two. I managed something working with Pascal before Christmas break, but now that I'm taking C++, I'd like to begin to re-design it with C++, where I could utilize a wider range of abilities... namely, using graphics.

    I asked the teacher; he said others had attempted to locate and enable the graphics library in the past, and gave me a list of the working libraries. I posted in another forum for help, and allegro was suggested to solve it; in trying to figure out how to properly install it, I happened to stumble across the graphics.h library, which strangely wouldn't run. In the code, there was this statement:

    Code:
    
    #if defined( _Windows ) && !defined (__DPMI16__) && !defined(__DPMI32__)
    #error BGI graphics not supported under Windows
    #endif
    So apparently, the lack of the __DPMI16__ file or the __DPMI32__ file must be what's disabling the usage of graphics. I tried to see how it would respond, were that code not in there; in only marking those three lines as comments, and the rest of the code left alone, it returned many errors, one which I can remember being that it didn't recognize the function far.

    Anyone know what __DPMI16__ or __DPMI32__ are and where I could find them, or better yet how I could get them installed on the computer and where to install them?

    If it helps any, here is the specifications of the programming computers I'd make the game on (minimal probability the program would be run on a computer with anything less):
    Pentium 3 600 Mhz
    motherboard : Intel VC820
    64Mb RAM
    graphic card: ATI Rage 3D pro agp2x
    Windows 98
    Last edited by ChronoSquare; 04-28-2006 at 02:59 PM.

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    That graphics library is for ancient, and nearly extinct, MS-DOS Version 6.X and earlier. All current versions of MS-Windows are 32-bit operating systems and any 32-bit compiler will not compile 16-bit code. What you need is ancient Borland Turbo C or Turbo C++. But its limited to programs no larger than 640K (actully a lot smaller).

    So, either you learn to use win32 api graphics functions or stay with Turbo C. DirectX or DirectDraw are propular graphic engines for MS-Dindows, but require expert knowledge of C/C++, definitely not for beginners.

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    If the graphics.h library didn’t come with your compiler, it won’t work with it. There is no standard graphics.h because there are no graphics in standard/portable C++. But, your compiler probably has some graphics capability.

    What compiler are you using? All Windows compilers can do simple graphics. For example, it’s really easy to put a simple shape in a Window. But, there’s a BIG catch… It’s not so easy to make a Window. Here’s a Windows Programming Tutorial .

    I’ve never used Allegro, but I believe that it is multi-platform. I’ve always assumed that you need to know regular Windows programming before jumping into Allegro or OpenGL, or anything like that… But, I could be wrong.
    Last edited by DougDbug; 04-28-2006 at 04:33 PM.

  4. #4
    Registered User
    Join Date
    Apr 2006
    Posts
    13
    Oh yeah... I meant to include the information that we are running on Borland C++ version 5.02, guess I missed that part.

    The Windows tutorial looks quite beneficial, if not for the fact that the code's in C... maybe it's just because I've done VERY little as far as syntax goes in C++, maybe it's because I've no clue what C code looks like, but even the first encounter of code in the tutorial confuses me...

    Error: Unresolved external '_main' referenced from C:\BC5\LIB\COX32.OBJ is what it returns to me, and that code has no main; to me it feels like that is something of a problem.

    Or should I just forego all of this, and insted reserve to switch back to the orignal conception, of merely using couts to create something of an image for each and no grid for it all? I've only until school ends, and after that no easy way to access C++ at all...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. Problem calling external method from within a shared library
    By Major Tom in forum C++ Programming
    Replies: 0
    Last Post: 04-21-2007, 09:14 AM
  4. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  5. Problem With WinPcap library
    By DrMario in forum C Programming
    Replies: 0
    Last Post: 03-26-2005, 11:26 AM