Mail Archives: djgpp/2000/01/23/17:34:14
sam <samirw AT connection DOT com> writes:
> Ok, boys anyone that knows what I am doing? I don't.
>
>
> I have the following source file TLFUNC.CC
[snip]
>
> I have compiled it with:
> d:\djgpp\applib\>gcc -c tlfunc.cc
>
> Now I create library with:
> d:\djgpp\applib\>ar -rs libtl.a tlfunc.cc
>
> verify that the index is there by doing list: (with -t not -s
> or -nm
>
> as the first page of info ar suggests.)
> d:\djgpp\applib\>ar -t libtl.a
> (get tlfunc.o)
> So, I try to build the following file: (maintest.cc)
[snip]
>
> With:
>
> 8:36:04.79
> D:\DJGPP\mytests>gpp maintest.cc -I..\applib -L..\applib\tl -o
> maintest.exe
You're confusing the options. The -L option gives a directory in
which to search for libraries. The -l (lower case) option actually
specifies a library. So what you want is:
gpp maintest.cc -I..\applib -L..\applib -ltl -l maintest.exe
> d:/djgpp/tmp\ccM794sS.o(.text+0x6b):maintest.cc: undefined reference to
> `color_t
> ext(int, int, int, int, char *)'
> d:/djgpp/tmp\ccM794sS.o(.text+0xa2):maintest.cc: undefined reference to
> `color_t
> ext(int, int, int, int, char *)'
> collect2: ld returned 1 exit status
>
> 8:36:32.25
> D:\DJGPP\mytests>
>
> GCC is the same think.
>
> BTW: which is the one that will pick language according to the extension
> GCC | GPP.
Both, really. The problem is that this only applies to the
compilation phase, and not the linking. So using foo.c vs foo.cc will
cause them to be compiled as the proper language, but it won't cause
the C++ libraries to be linked. You always have to tell the compiler
that by using `gpp'.
--
Nate Eldredge
neldredge AT hmc DOT edu
- Raw text -