> > main.o: In function `main':
> > /Users/rwessels/tmp/log_bug/main.c:9: undefined reference to `log'
> 
> you probably did not link the math library. try adding "-lm" when you're 
> linking.

Actually:

[tron@HAL9000 log]$ cat log.c 
#include <msp430.h>
#include <math.h>

unsigned int foo = 10;
int main()
{
    double var = log(foo);
    var++;
    return 0;
}
[tron@HAL9000 log]$ msp430-gcc -Os -lm -mmcu=msp430g2553 -o log log.c 
/tmp/ccprYmUi.o: In function `main':
log.c:(.init9+0xc): undefined reference to `log'
collect2: ld returned 1 exit status
[tron@HAL9000 log]$ pacman -Q gcc-msp430 msp430-libc
gcc-msp430 4.6.3-3
msp430-libc 20120224-2
[tron@HAL9000 log]$ pacman -Ql msp430-libc | grep libm
[snip]
msp430-libc /usr/msp430/lib/libm.a
[snip]
[tron@HAL9000 log]$ msp430-gcc -L/usr/msp430/lib -Os -lm
-mmcu=msp430g2553 -o log log.c 
/tmp/ccgcsd6H.o: In function `main':
log.c:(.init9+0xc): undefined reference to `log'
collect2: ld returned 1 exit status


Not exactly sure why, but this issue happened to me before as I was
linking a static library I wrote.

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to