Where is math.h?
Where is math.h?
Hi, I try to use sqrt() and atan() functions. Where they are in IDF library? Which header file declares them?
Re: Where is math.h?
Hi valery,
math.h is installed as part of the libc (newlib), so on recent ESP-IDF versions it's installed alongside the toolchain (gcc) not inside ESP-IDF itself. If you look around the location where the toolchain is installed then you can find it (note that recent versions of ESP-IDF ship a few different newlib variants with different compile options so there may be multiple toolchain subdirectories with different newlibs).
However, you may not need to find this header. All the libc standard functions in math.h should be present and the header should include cleanly, and the functions should compile and link correctly.
If you're having a specific problem getting something to work, please post some more details and the error message and we'll try to help.
math.h is installed as part of the libc (newlib), so on recent ESP-IDF versions it's installed alongside the toolchain (gcc) not inside ESP-IDF itself. If you look around the location where the toolchain is installed then you can find it (note that recent versions of ESP-IDF ship a few different newlib variants with different compile options so there may be multiple toolchain subdirectories with different newlibs).
However, you may not need to find this header. All the libc standard functions in math.h should be present and the header should include cleanly, and the functions should compile and link correctly.
If you're having a specific problem getting something to work, please post some more details and the error message and we'll try to help.
Re: Where is math.h?
Thank you. Is there a way to find location of a header file without IDE? Some time just want to look inside a header file, and wondering if IDF has some analog to 'whereis' tool.
Re: Where is math.h?
I have a similar problem. When I add math.h I get warning "The math library must be enabled by CONFIG_NEWLIB_LIBC to be included in the build. Due to this fact, I added sdkconfig.defaults file where I added CONFIG_NEWLIB_LIBC=y and instead of <math.h> I include <newlib.h>. I try to use math functions but are not visible. Please let me know what I have to do?
-
- Posts: 52
- Joined: Thu Jun 22, 2023 12:50 pm
Re: Where is math.h?
Hi SamoESP, what do you use Arduino or ESP-IDF? Also what version? I cannot reproduce your problem. ESP32 ROM and ESP-IDF use Newlib instead of glibc as their standard C library, it is always included. You should be able to just do `#include <math.h>`.
Who is online
Users browsing this forum: rsimpsonbusa and 86 guests