Unable to use log() in my code facing linker error #61553
-
Hello Everyone ! I'm new to zephyr, void main() I'm getting this linker error:
`arm-gn~1.rel/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.bfd.exe: w_log.c:(.text.log+0x38): undefined reference to
Board: lpcxpresso55s16 Please help me to fix this issue , if need more clarification please let me know, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's not how you do it in Zephyr. apply the patch bellow and run the following command. This means that
You can use interactive UI if you want: https://docs.zephyrproject.org/latest/build/kconfig/menuconfig.html
diff --git a/samples/hello_world/prj.conf b/samples/hello_world/prj.conf
index b2a4ba59104..6bea429b0f3 100644
--- a/samples/hello_world/prj.conf
+++ b/samples/hello_world/prj.conf
@@ -1 +1,2 @@
-# nothing here
+CONFIG_PICOLIBC=y
+CONFIG_PICOLIBC_IO_FLOAT=y
diff --git a/samples/hello_world/src/main.c b/samples/hello_world/src/main.c
index bc7a4c1d716..362b433b353 100644
--- a/samples/hello_world/src/main.c
+++ b/samples/hello_world/src/main.c
@@ -5,9 +5,10 @@
*/
#include <zephyr/kernel.h>
+#include <math.h>
int main(void)
{
- printk("Hello World! %s\n", CONFIG_BOARD);
+ printk("Hello World! %lf\n", log(22));
return 0;
} To build for your board,
BTW, please use triple backticks to encode your code.
|
Beta Was this translation helpful? Give feedback.
That's not how you do it in Zephyr.
apply the patch bellow and run the following command. This means that
CONFIG_PICOLIBC=y
CONFIG_PICOLIBC_IO_FLOAT=y
You can use interactive UI if you want: https://docs.zephyrproject.org/latest/build/kconfig/menuconfig.html