c graphics problem ( pls help )

This is a discussion on c graphics problem ( pls help ) within the C Programming forums, part of the General Programming Boards category; when i try to compile the below code in borland c++ 5.5 , it show "graphics.h" can't be included . ...

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

    c graphics problem ( pls help )

    when i try to compile the below code in borland c++ 5.5 , it show "graphics.h" can't be included . but when i try to compile the same code in turbo c++ 3.5 ( dos ) it does't show any error and runs quite well.

    I had copy paste the graphics.h and graphics.lib files into borland c++'s respective directories. Still there is errors.

    My question is how to run graphics programs in borland c++ or any windows based compiler ( not in dos )?

    please help me .
    thank you.

    Code:
    #include <graphics.h>
    
    main ()
    {
           int gd=DETECT,gm;
           
          initgraph(&gd,&gm,"c:\\tc\\bgi"); // remember there is no    bgi files in borland c++ 5.5
          
          setcolor ( RED);
          line ( 25,25,100,25);
          
          closegraph();
          restorecrtmode();
    }
    Last edited by abhijeetnayak; 05-23-2006 at 08:32 AM.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    If you want to use DOS, use DOS. Otherwise, find a Windows-compatible graphics library. The Windows API supports graphics directly, but the folks in the Windows forum can direct you more accurately based on your needs.

    >I had copy paste the graphics.h and graphics.lib files into borland c++'s respective directories.
    I would be very surprised if this worked, but at least you tried copying the .lib too. Most people just copy the header and expect some kind of magic. In reality, libraries are usually written for a specific compiler, and moving them to another compiler (even a newer version) is often doomed to failure.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    12
    thanks preluse,

    can you suggest any Windows-compatible graphics library or any windows forum where i should look for .

    thanks again.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >or any windows forum where i should look for
    Click the back button twice on your browser and you'll see that our board has a Windows forum. Or for the navigation impaired, just go here.
    My best code is written with the delete key.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,418
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Graphics problem with Borland C++
    By B_Level in forum C++ Programming
    Replies: 10
    Last Post: 06-16-2006, 10:02 PM
  2. WSAD Problem Pls Help
    By Ti22 in forum Game Programming
    Replies: 1
    Last Post: 01-16-2005, 10:24 AM
  3. DoModal() problem --> pls help.
    By intruder in forum Windows Programming
    Replies: 7
    Last Post: 10-03-2004, 12:49 AM
  4. FPS Problem, pls help
    By Unregistered in forum Game Programming
    Replies: 11
    Last Post: 06-21-2002, 12:03 PM
  5. Spot the problem..a test question, pls help!
    By Unregistered in forum C++ Programming
    Replies: 10
    Last Post: 02-05-2002, 12:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21