2021-06-17 11:22 AM
2021-06-17 12:59 PM
I can compile if I use the non-generic versions such as powf or powl but not the generic version. But I still don't understand what changed.
2023-04-25 11:12 AM
I have encountered the same (or a similar) issue. My project is fine with STM32 Cube IDE v1.0.0 - 1.5.1, but v1.6.0 onward have problems. Here are the error messages, and one of the source lines that caused problems.
error: 'cpowl' undeclared (first use in this function); did you mean 'cpowf'?
error: 'cexpl' undeclared (first use in this function); did you mean 'cexpf'?
error: argument 6 of '__builtin_tgmath' is not a function pointer
float b = A1 + B1*log(r) + C1*pow(log(r), 2) + D1*pow(log(r), 3);
Here are some more things I tried, with Cube IDE v1.6.0.
(1) If I replace log(), exp(), pow() with logf(), expf(), powf() in my program, it builds successfully.
(2) If I replace #include <tgmath.h> with #include <math.h>, it builds successfully.
(3) The simple program below builds successfully.
(4) The simple program below fails if I replace math.h with tgmath.h.
#include <math.h>
int main(void)
{
HAL_Init();
SystemClock_Config();
while (1)
{
volatile float x, y, z;
y = 2;
z = 3;
x = exp(y) + pow(y,z);
}
}
Here are some questions:
- Why doesn't tgmath.h work with IDE v1.6.0 and later?
- Does it work for anyone else?
- How can I get tgmath.h to work?