Facing problem even in basic C++ graphics programs compilation!!!HELP

Discussion in 'C Programming' started by risshahaprma, Jan 23, 2010.

  1. risshahaprma

    risshahaprma Guest

    I made a simple program to draw line but it gives errors.I am not able
    to debug them and feeling frustrated as I canna even get myself
    started for graphics ! When I used the same code in my computer lab it
    worked fine..Plz help..I would really appreciate your response!


    #include <graphics.h>
    #include <iostream.h>
    #include <conio.h>

    int main()
    {
    /* request auto detection */
    int gdriver = DETECT, gmode;

    /* initialize graphics mode */
    initgraph(&gdriver, &gmode, "c:/tc/bgi");

    /* draw a line */
    line(0, 0, 400, 400);
    getch();
    return 0;
    }
    error 1:undefined symbol _line in module ris.cpp

    error 2:undefined symbol _initgraph in module ris.cpp
     
    risshahaprma, Jan 23, 2010
    #1
    1. Advertising

  2. risshahaprma <> writes:
    > I made a simple program to draw line but it gives errors.I am not able
    > to debug them and feeling frustrated as I canna even get myself
    > started for graphics ! When I used the same code in my computer lab it
    > worked fine..Plz help..I would really appreciate your response!
    >
    >
    > #include <graphics.h>
    > #include <iostream.h>
    > #include <conio.h>
    >
    > int main()
    > {
    > /* request auto detection */
    > int gdriver = DETECT, gmode;
    >
    > /* initialize graphics mode */
    > initgraph(&gdriver, &gmode, "c:/tc/bgi");
    >
    > /* draw a line */
    > line(0, 0, 400, 400);
    > getch();
    > return 0;
    > }
    > error 1:undefined symbol _line in module ris.cpp
    >
    > error 2:undefined symbol _initgraph in module ris.cpp


    This is comp.lang.c; comp.lang.c++ is down the hall on the left.

    But you'd probably run into the same problem if you were using C, so
    I'll try to give you a hint or two.

    Neither <graphics.h> nor <conio.h> is a standard header in either
    C or C++. They're probably provided by your implementation.
    Since your code compiles, you apparently have the headers available
    both in your computer lab and wherever else you're trying this (you
    didn't say). Errors like "undefined symbol" are typically produced
    by the linker, and can indicate that you didn't tell the linker
    where to find the required library or libraries. Probably whatever
    library is associated with the header <graphics.h> is the culprit.
    I don't know how to tell the linker (whichever one you're using)
    to load that library (whatever it is); you'll have to find that
    out elsewhere, either by reading your system's documentation or by
    asking in another forum.

    Note that the folks in comp.lang.c++, though they know plenty about
    the C++ language, are no more likely than we are to know about this
    <graphics.h> header or its associated library.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Jan 23, 2010
    #2
    1. Advertising

  3. "risshahaprma" <> wrote in message
    news:...
    >I made a simple program to draw line but it gives errors.I am not able
    > to debug them and feeling frustrated as I canna even get myself
    > started for graphics ! When I used the same code in my computer lab it
    > worked fine..Plz help..I would really appreciate your response!
    >
    >

    <snip>

    looks like Borland C or Turbo C...

    either way, note that code specific to these compilers will not work
    anywhere else, and FWIW, this code uses Borland-specific extensions...

    so, if one wants portable code, write portable code...
     
    BGB / cr88192, Jan 23, 2010
    #3
  4. risshahaprma

    Paul N Guest

    Re: Facing problem even in basic C++ graphics programscompilation!!!HELP

    On 23 Jan, 04:56, risshahaprma <> wrote:

    (snip)

    > error 1:undefined symbol _line in module ris.cpp
    >
    > error 2:undefined symbol _initgraph in module ris.cpp


    If you're using Turbo C++, then the instructions in my manual are as
    follows:

    If you're using the IDE, make sure full menus are on, go to Options /
    Linker and check Graphics library.

    If you're using the command line, use tcc myprog graphics.lib

    Hope this helps. If it doesn't, you'll have to try a group relevant to
    your system.
    Paul.
     
    Paul N, Jan 24, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FuZHk=?=

    Suggested Graphics Programs for use with VS

    =?Utf-8?B?U2FuZHk=?=, Oct 1, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    337
    Mr Newbie
    Oct 1, 2005
  2. Stan Goodman

    Even older fart, even newer newbie

    Stan Goodman, Jul 3, 2003, in forum: Java
    Replies:
    11
    Views:
    704
    Stan Goodman
    Jul 4, 2003
  3. Replies:
    12
    Views:
    1,661
    Dave Thompson
    Jan 10, 2005
  4. Coca
    Replies:
    7
    Views:
    749
    Aidan Grey
    Aug 24, 2004
  5. jacob navia

    facing problem during compilation

    jacob navia, Sep 21, 2007, in forum: C Programming
    Replies:
    16
    Views:
    695
    Army1987
    Sep 22, 2007
Loading...

Share This Page