Thread: really noobish problem

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    2

    really noobish problem

    hi i have problems running this program :


    Code:
    
    #include <graphic.h>
    #include <stdlib.h>
    #include <conio.h>
    
    int main (void)
    
    {
    
    
    
    /* request auto detection */
    
       int gdriver =DETECT,gmode,errorcode;
    int xmax,ymax;
    
    /* intialize grafics and local variables */
    initgraph(&gdriver,gmode,"");
    
    /* read result of initialization*/
    errorcode = graphresult();
    /* if an error ocurred */
    if (errorcode !=gr0k)
    
    {
    printf("Grephics error:%s \n",grapherrormsg(errorcode));
    printf("press any key to halt:");
    getch();
    exit(1);
    
    }
    setolor(getmaxcolor());
    xmax= getmaxx();
    ymax = getmaxy();
    
    /*draw diagonal line*/
    line (0,xmax,ymax);
    
    /*clean up*/
    getch;
    closegraph();
    return 0;
    }
    when i try to running it appears this error :

    11 D:\aspel\koi.cpp `DETECT' undeclared (first use this function)


    im using DEV-C++

    WHAT AM I DOING WORNG =?? i tried with visual c++ but it says:

    fatal error C1083: Cannot open include file: 'graphic.h': No such file or directory
    Error executing cl.exe.

    i dont even know how to install the graphic.h library please help
    than you in advanced

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    It's very old Borland code.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    2
    and what about the libraries can anyone tell me how to install em=?? and how can i run it if its and old borlnad code ...maybe with a borland compiler any recommendations=???

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Or maybe just use the dev-c++ package manager to download LibSDL (see http://www.libsdl.org/index.php) and start using more capable graphics and leave that old fossil where it belongs, in the history museum.

  5. #5
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    Indeed. "very old' isn't an exaggeration. The Borland Graphics Interface that this code reeks of was around in at least 1987, if not earlier. It became obsolete when MS-DOS did.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM