Linker error

Hakan Bal balhakan@hotmail.com
Wed Jul 11 07:19:00 GMT 2001


Hello,
I am currently using gcc 2.91.66. When trying to link a c++ program from its 
object files using a library i get a linker error. It seems that the linker 
finds the library but cannot link the object files somehow. The verbose 
output of the output is below.
Library is unuran and it seems to work fine with gcc. Some c program for 
testing the library works fine with gcc but gives about the same output as 
the previous case.
Anyone have an idea what the problem is ?

g++ -v -O3 -w -o main datatype.o general.o histogram.o \
        inoutinterface.o kernel.o optimization.o randgen.o \
        samplestatistics.o statistics.o main_u.o \
        -lunuran -lprng -lm
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/collect2 -m elf_i386 
-dynamic-linker /lib/ld-linux.so.2 -o main /usr/lib/crt1.o /usr/lib/crti.o 
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/crtbegin.o 
-L/home/balhakan/lib -L/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66 
-L/usr/i386-redhat-linux/lib datatype.o general.o histogram.o 
inoutinterface.o kernel.o optimization.o randgen.o samplestatistics.o 
statistics.o main_u.o -lunuran -lprng -lstdc++ -lm -lgcc -lc -lgcc 
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/crtend.o /usr/lib/crtn.o
main_u.o: In function `main':
main_u.o(.text+0x65): undefined reference to `unur_distr_student(double *, 
int)'
main_u.o(.text+0x6b): undefined reference to `unur_arou_new(unur_distr *)'
main_u.o(.text+0x74): undefined reference to `unur_init(unur_par *)'
main_u.o(.text+0x117): undefined reference to `unur_sample_cont(unur_gen *)'
collect2: ld returned 1 exit status
make: *** [final] Error 1

Regards

Hakan
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com .



More information about the Gcc-help mailing list