math libraries....

I am trying to compile a program but gcc/qcc can’t find the libm (floor,
tan, etc.)
Have I missed any packages? A collegue is running the same program without
any additional flags to the compiler/linker!

Thanks,

$ qcc benchmarks.c
/tmp/AAA528414_cc.o: In function calculationsTest': /tmp/AAA528414_cc.o(.text+0x324): undefined reference to tan’
/tmp/AAA528414_cc.o(.text+0x33b): undefined reference to atan' /tmp/AAA528414_cc.o(.text+0x352): undefined reference to sqrt’
/tmp/AAA528414_cc.o(.text+0x36e): undefined reference to sin' /tmp/AAA528414_cc.o: In function stringManip’:
/tmp/AAA528414_cc.o(.text+0x49e): undefined reference to `floor’
cc: /usr/bin/ld error 1
$ qcc -llibm benchmarks.c
/usr/bin/ld: cannot open -llibm: No such file or directory
cc: /usr/bin/ld error 1
$ ls /lib/libm*
/lib/libm.a /lib/libm.so.1
/lib/libm.so /lib/libmS.a
$ gcc -L/lib -llibm benchmarks.c
/usr/ntox86/bin/ld: cannot open -llibm: No such file or directory
collect2: ld returned 1 exit status

Berkeley Process Control <bpc@berkeleyprocess.com> wrote:

I am trying to compile a program but gcc/qcc can’t find the libm (floor,
tan, etc.)
Have I missed any packages? A collegue is running the same program without
any additional flags to the compiler/linker!

Thanks,

$ qcc benchmarks.c
/tmp/AAA528414_cc.o: In function calculationsTest': /tmp/AAA528414_cc.o(.text+0x324): undefined reference to tan’
/tmp/AAA528414_cc.o(.text+0x33b): undefined reference to atan' /tmp/AAA528414_cc.o(.text+0x352): undefined reference to sqrt’
/tmp/AAA528414_cc.o(.text+0x36e): undefined reference to sin' /tmp/AAA528414_cc.o: In function stringManip’:
/tmp/AAA528414_cc.o(.text+0x49e): undefined reference to `floor’
cc: /usr/bin/ld error 1
$ qcc -llibm benchmarks.c
/usr/bin/ld: cannot open -llibm: No such file or directory
cc: /usr/bin/ld error 1
$ ls /lib/libm*
/lib/libm.a /lib/libm.so.1
/lib/libm.so /lib/libmS.a
$ gcc -L/lib -llibm benchmarks.c
/usr/ntox86/bin/ld: cannot open -llibm: No such file or directory
collect2: ld returned 1 exit status

Just use -lm not -llibm

Thomas

Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf