My command line is: msp430-gcc -mmcu=msp430g2553 main.c -o foo.elf -lm
Note -lm needs to be after the .c files to be picked up..
This results in:
/var/folders/_2/jkjmx9g52rld63ptzv1j4w4h0000gn/T//ccUsXLlr.o: In function
`main':
main.c:(.init9+0x14): undefined reference to `log'
collect2: ld returned 1 exit status
If I replace log() with logf() then it links OK. If -lm is omitted in the logs
case a similar error is thrown by the compiler indicating the -lm was picked up
correctly and thus log() should have worked too.
Robert
On Sep 16, 2012, at 4:35 PM, Robert Wessels wrote:
> One of the Energia users stumbled upon what seems to be a bug.
> The following compiles just fine.
>
> #include <msp430.h>
> #include <math.h>
>
> unsigned int foo = 0;
> int main()
> {
> double var = log(1024);
> var++;
> }
>
> This piece of code however gives:
>
> main.o: In function `main':
> /Users/rwessels/tmp/log_bug/main.c:9: undefined reference to `log'
> collect2: ld returned 1 exit status
> make: *** [null.elf] Error 1
>
>
> #include <msp430.h>
> #include <math.h>
>
> unsigned int foo = 0;
> int main()
> {
> double var = log(foo);
> var++;
> }
>
> Seems that log() does not like variables.
>
> Robert
>
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users