#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) ks...@mib.org <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"
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...
(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.