Thread: c graphics problem ( pls help )

  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,897
    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,897
    >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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

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, 11: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, 01:40 AM