undefined reference to "function name"
llewelly@edevnull.com
llewelly@edevnull.com
Thu Sep 28 11:03:00 GMT 2000
Pavlos Parissis <surfking@x-treme.gr> writes:
> Hello,
>
> >
> > On my i686-linux-pc-gnu system, I successfully compiled and linked
> > your example with the following command line:
> >
> > gcc -g -v -Wall -L/usr/X11R6/lib -lX11 -lXtst X_fun.c
-l/usr/X11R6/lib tells gcc to look in /usr/X11R6/lib for libraries.
-lX11 tells gcc to link your code with libX11 .
-lXtst tells gcc to link your code with libXtst .
Please read http://gcc.gnu.org/onlinedocs/gcc_2.html#SEC14 to learn
more about these flags.
(You can also find this information in the info pages that come with
gcc.)
> >
>
> ok i tried it and it worked, but why?
> I mean, before install RedHat 6.2 i had 5.1 and i compiled the same program
> without
> -L/usr/X11R6/lib -lX11 -lXtst in gcc command.
Odd. Code that uses libraries should *not* link unless gcc is told
what libraries to link against, and where to look for those libraries.
[snip]
More information about the Gcc-help
mailing list