Mail Archives: djgpp/1995/11/08/02:22:33
On Wed, 8 Nov 1995, Teng Yong Jeffrey wrote:
> But when I try to use the functions in gppconio.h (gotoxy),
> gcc gives me "undefined reference to 'gotoxy'"
[snip]
> What I don't get is, from the FAQ, it seems like just by getting and
> unzipping the two files GPP263.zip and LGP262bn.zip, I can use the
> C++ functions already. So how come GCC gives me these errors?
This has nothing to do with C++. conio functions are in the libpc.a
library, and the linker doesn't search it by default. This is explained
in the FAQ (get the latest in faq102.zip, if you don't have it already),
section 8.8:
8.8 Q: When I compile my program, the linker complains about mathematical
functions, although I did #include <math.h>.
Q: The linker complains it cannot find cprintf function.
Q: Why do I get so many unresolved symbols when linking C++ programs?
A: By default, gcc instructs the linker to only look in two libraries:
libgcc.a and libc.a. Some functions aren't included there, so the
linker can't find them. For math functions, like sin() and exp(),
append ``-lm'' to the gcc command line; for pc-specific
functions, like cputs() and cprintf() append ``-lpc''; to use C++
classes append ``-lgpp''. GPL library routines, like obstack and
regex packages are in libgpl.a library; append ``-lgpl'' to use
them.
It's probably worthwhile to also read a few sections which follow 8.8
and discuss related issues.
- Raw text -