linking with -lm to use math library functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

linking with -lm to use math library functions



Hello all.  I'm trying to compile code with the 'log' function using sourcery g++ lite tools. It compiles ok and finds <math.h>, but gets an error during link.  I'm using the standard makedef provided from Luminary Micro to use with their LM3S6965 with the addition of the -lm flag to pull in the math libraries.  However, I'm not sure where to go from here, so any help would be much appreciated.  I can include the map file (or anything else) if it would help nail down the problem.  Thanks in advance.

Here's the source:
//*****************************************************************************
// test.c - Simple example
//*****************************************************************************
#include "../../DriverLib/inc/lm3s6965.h"
#include <math.h>
int
main(void)
{
    double a=2.0,b=3.0,c=4.0;
    
    a = pow(b,c);
    c = log(a);

}


The Output:

arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -O2 -MD -std=c99 -Wall -pedantic -DPART_LM3S6965 -c -Dgcc -o gcc/test.o test.c
arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -O2 -MD -std=c99 -Wall -pedantic -DPART_LM3S6965 -c -Dgcc -o gcc/startup_gcc.o startup_gcc.c
arm-none-eabi-ld -T ../../DriverLib/gcc/standalone.ld --entry ResetISR --gc-sections -o gcc/test.axf gcc/test.o gcc/startup_gcc.o c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.2.1/../../../../arm-none-eabi/lib/thumb2/libc.a c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.2.1/thumb2/libgcc.a -lm

c:\program files\codesourcery\sourcery g++ lite\bin\../arm-none-eabi/lib\libm.a(lib_a-w_log.o): In function `log':
w_log.c:(.text+0x50): undefined reference to `__aeabi_dcmpgt'
w_log.c:(.text+0xbc): undefined reference to `__aeabi_dcmpeq'
w_log.c:(.text+0x128): undefined reference to `__errno'
w_log.c:(.text+0x138): undefined reference to `__errno'
w_log.c:(.text+0x148): undefined reference to `__errno'
c:\program files\codesourcery\sourcery g++ lite\bin\../arm-none-eabi/lib\libm.a(lib_a-e_log.o): In function `__ieee754_log':
e_log.c:(.text+0x44): undefined reference to `__aeabi_ddiv'
e_log.c:(.text+0x60): undefined reference to `__aeabi_dmul'
e_log.c:(.text+0x98): undefined reference to `__aeabi_dadd'
... more...

make: *** [gcc/test.axf] Error 1




      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com