Hi!

I'm using msp430-gcc in a CVS-checkout version from 01.07.2004 (a little bit
old, but I'm not the administrator).

If I try to compile the following dummy
program
/*********************************************************************************/
#include <stdlib.h>
#include <msp430x14x.h>
#include <math.h>

int main (void) {
        float a,b;

        a = 1.2345;
        b = exp(a) + sin(a) + log(a);
        P1OUT = (char)b;

        return
CPUOFF;
}
/*********************************************************************************/

with the command

msp430-gcc -g -O2 -mmcu=msp430x149 -lm dummyprogram.c -o dummyprogram.elf

I get the errors

... undefined reference to `exp'
... undefined reference to `sin'
... undefined reference to `log'

If I change the command to 

msp430-gcc -g -O2 -mmcu=msp430x149 dummyprogram.c -o dummyprogram.elf -lm

I get only the errors

... undefined reference to `exp'
... undefined reference to `log'


The option -lm is given everytime and therefore math.h should be linked to
the program, but it fails. It fails completely, if -lm is given as one of
the first options. If it is given at the end of the command line, the sin(x)
function from math.h is linked, but none of the other tested functions.

Where is my error? Is it a bug of my old MSPGCC version?

Thanks for help!
Ralf

Reply via email to