Torfs Tom wrote:
Everyone,
I've been trying unsuccessfully to use math library functions such as pow(),
expf() etc. with mspgcc (running on Windows). I downloaded the latest version
and the problem still exists. I created a minimal example which exhibits the
problem:
fptest.c:
/* minimal program showing math linking problems */
int main(void)
{
float a,b,c;
a = 1.234;
b = 5.678;
c = pow(a,b);
return 0;
}
compiled with this command:
msp430-gcc -g -mmcu=msp430x149 -o2 -lm fptest.c -o fptest.elf
Results in the following error:
W:\msp430\stack-code>msp430-gcc -g -mmcu=msp430x149 -o2 -lm fptest.c -o
fptest.elf
/cygdrive/c/DOCUME~1/torfst/LOCALS~1/Temp/ccGrKWzV.o(.text+0x2e): In function
`main':
/cygdrive/w/msp430/stack-code/fptest.c:9: undefined reference to `pow'
I tried adding -lfp as well as -lm, adding a global float variable, ... but it
does not make a difference. What am I missing?
Put the -lm after your fptest.c file on the command line ie
msp430-gcc -g -mmcu=msp430x149 -o2 fptest.c -lm -o fptest.elf
the linker is only one (or two I forget) not three pass.
Regards,
--
Peter Jansen
STS
Australian Antarctic Division
Channel Highway
Kingston
TAS 7050
AUSTRALIA
Ph (03) 62 323 533
Fax (03) 62 323 351