Page 1 of 1

undefined reference to `log'

Posted: Wed Aug 22, 2018 7:59 am
by Walmore
Hi, there.
I'm trying to compile an algorithm that contains the "Log" function. I have included the Math.h library but when I try to compile it gives me the following error per console:
src\Lectura_Termistor.o: In function `Calculo':
Lectura_Termistor.c:(.text.Calculate+0x7e): undefined reference to `log'
collect2.exe: error: ld returned 1 exit status

Can you give some comment?
Best regards!

Re: undefined reference to `log'

Posted: Fri Aug 24, 2018 8:28 am
by aoc
Hi Walmore,

Under Eclipse, you need to right click on your project and go into Properties.

Then, you go in "C/C++ Build" > "Settings" and select "Libraries" under the "ARM Sourcery Windows GCC C Linker" section.
You click on the add icon on top right and enter "m" (without quotation marks) for the library to use.


Re: undefined reference to `log'

Posted: Thu Aug 30, 2018 8:11 pm
by Walmore
I've already been able to fix it thanks to your information.
A new question, how do I print float variables on the screen which syntax indicator to use? i tried with "%f" but it doesn't show anything.
And how can I send a "float" variable by TD_SIGFOX_Send command to the sigfox backend?
Best regards.

Re: undefined reference to `log'

Posted: Wed Sep 05, 2018 12:42 pm
by cclerdan

You can't print directly a float with the tfp_printf() function. It does not support float format.
I suggest that you print / send the value in hexa format and then do the conversion.
Or you can multiply the value in order to suppress the fractional part.