Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: problems using math.h

2005-08-12 by wiese_matthias

I had similar problems. Then I changed the order of my linker flags
(and even duplicated them like: "-lm -lc -lgcc -lstdc++ -lm")...and it
worked. Good Luck!
Matthias

  

--- In lpc2000@yahoogroups.com, "oemtyo" <plessing@e...> wrote:
> Hi everyone,
> 
> I'm programming an application for lpc2119 and need to do 
> complex mathematical calculations with values got from the
> A/D-Converter. Therefore i need to include the math.h to be
> able to call functions such as pow() or sqrt() ...
> 
> The linker-flag "-lm" to include the math-library is set.
> (GNU ld version 2.14 20030612)
> 
> But using newlib version 1.12.0 and arm-elf-gcc 3.3.3 I get 
> several linker errors with undefined references to functions
> the libm.a should provide.
> 
> <snip>
> make -k all 
> arm-elf-ld -v -omain.prg ./crt0.o smon_main.o armVIC.o printf.o
> -T./lpc2119.ld -Map map
> /home/lpc2119/arm-elf/arm-elf/lib/libm.a(w_pow.o)(.text+0x80): In
> function `pow':
> /home/lpc2119/newlib-1.12.0/newlib/libm/math/w_pow.c:88: undefined
> reference to `__eqdf2'
> /home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(w_
> pow.o)(.text+0x128):/home/lpc2119/newlib-1.12.0/ne
> wlib/libm/math/w_pow.c:108:
> undefined reference to `__eqdf2'
> [...]  8 lines more
> /home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(e_pow.o)(.text+0x4c8):
> In function `__ieee754_pow':
> /home/lpc2119/newlib-1.12.0/newlib/libm/math/e_pow.c:271: undefined
> reference to `__gtdf2'
> /home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(e_
> pow.o)(.text+0x98c):/home/lpc2119/newlib-1.12.0/ne
> wlib/libm/math/e_pow.c:277:
> undefined reference to `__ledf2'
> [...] 4 lines more
> In function `__ieee754_sqrt':
> /home/lpc2119/newlib-1.12.0/newlib/libm/math/e_sqrt.c:180: undefined
> reference to `__gtdf2'
> GNU ld version 2.14 20030612
> make: *** [main.prg] Errors 1
> make: Target »all« not compiled due to errors.
> </snip>
> 
> Any idea on fixing this?
> 
> Thanks in advance.
> 
> Markus Plessing

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.