cancel
Showing results for 
Search instead for 
Did you mean: 

I just updated STM32CubeIDE from version 1.5 to 1.6.1. Now some of my math function calls are no longer working - such as pow(). The compile error I receive is : argument 6 of ‘__builtin_tgmath’ is not a function pointer. What has changed?

erussell
Associate II
 
2 REPLIES 2
erussell
Associate II

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.

KOler.1
Associate

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?