Thread: graphics.h link errors

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    26

    graphics.h link errors

    Hi, I have a 16 bit DOS app and am getting link errors, first here is my code to get a picture of what im doing:

    Code:
    #include <dos.h>
    #include <graphics.h>
    #include <conio.h>
    
    int main()
    {
        int gdriver = DETECT;
        int gmode = IBM8514LO;
       
        initgraph(&gdriver, &gmode, "");
     
        putpixel(0, 0, 0);
    
        getch();
        closegraph();
        return 0;
    }
    Now, here are the errors Im getting:

    Undefined Symbol _initgraph in module dos.cpp
    Undefined Symbol _closegraph in module dos.cpp
    Undefined Symbol _putpixel in module dos.cpp

    Were is my mistake?
    "Borland Rocks!"

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    If you're using the IDE, do you have the BGI library included with the target build?
    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
    Jul 2003
    Posts
    26

    that is it

    No, I didnt, thanks!

    ohh and by the way, where is the target expert?
    "Borland Rocks!"

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    26

    ohh yeah

    Never mind, I know, Thanks man
    "Borland Rocks!"

  5. #5
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164

    Re: graphics.h link errors

    Originally posted by nold

    Undefined Symbol _initgraph in module dos.cpp
    Undefined Symbol _closegraph in module dos.cpp
    Undefined Symbol _putpixel in module dos.cpp

    Were is my mistake?
    On your compile line you need to add graphics.lib -- that's where those functions live.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  6. #6
    Registered User
    Join Date
    Aug 2003
    Posts
    2

    Are you using a IDE for DOS?

    Here's the solution for TC/BC

    Options -> Linker -> Libraries

    Check 'Graphics Library'

  7. #7
    Registered User
    Join Date
    Jul 2003
    Posts
    26

    cant find <egavga.bgi>

    Now it runs and all but displays a bgi error saying it cant find egavga.bgi. Its looking right at it too. what does this mean?
    "Borland Rocks!"

  8. #8
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >Now it runs and all but displays a bgi error saying it cant find egavga.bgi.

    Do any of the suggestions here help?
    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.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I'm confused about link lists (again)
    By JFonseka in forum C Programming
    Replies: 4
    Last Post: 06-13-2008, 08:13 PM
  2. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 08:00 AM
  3. SDL Link Errors.
    By suzakugaiden in forum Game Programming
    Replies: 2
    Last Post: 06-15-2005, 05:40 PM
  4. executing errors
    By s0ul2squeeze in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2002, 01:43 PM