I have an issue with a sketch that I am working on. The sketch uses the following libraries:
#include <BME280I2C.h>
#include <Wire.h>
#include <SPI.h>
#include <RF24-STM.h>
It is compiled for the "generic STM32F103C series" boards. It compiled fine several weeks ago but I took a break from working on the sketch to do other things. Recently, I got back to the project and when I started the arduino IDE, I got the message that there were library and board updates and, as usual, I installed all the updates for libraries and boards that I use.
When I attempted to compile the sketch, I got the following error:
"D:\Documents\Arduino\libraries\BME280\src\EnvironmentCalculations.cpp:86:28: error: 'isnan' was not declared in this scope
if (metric && !isnan(temp) && !isnan(hum))"
Actually, I got serveral of these errors because isnan() is called multiple times in the BME280 library routines.
I went back through the updates and discovered that the issue is associated with an update to the board "STM32F1xx/GD32F1xx boards". If I revert back to version 2020.5.18 which is the level that I was at when I last worked on this sketch, it compiles with no errors. However, if I reinstall any of the updates for this board (2020.5.26 thru current level 2020.6.17) then I get this compilation error.
I went to the online help link for this board as listed in the board manager (https://www.stm32duino.com/) and created a forum entry (see forum topic "error: 'isnan' was not declared in the scope isnan(n)" or link [Solved] error: 'isnan' was not declared in this scope isnan(n); - Arduino for STM32) for more information. The last response that I received on this topic is:
Re: error: 'isnan' was not declared in this scope isnan(n);
Post by stevestrong » Fri Jun 19, 2020 7:17 am
This error is only shown with the original 4.8.3 GCC compiler version. Because I use 7.2.1, this was not visible.
The solution is to insert:
#include <math.h>
using namespace std;
before setup().
I just committed a fix in the repo.
Please check out the latest version and let me know if it works.
I have responded to "stevestrong" that the current level 2020.6.17 does not resolve the issue and this his suggestion does not resolve the issue because placing these statements in my base sketch does correct the compile error which occurs in the routines in the library BME280.
I am creating this topic in the arduino forums to document this issue to the general arduino community and to solicit comments on who should resolve this issue and possibly get information on where the gcc/g++ compiler gets installed and configured. Also, if this turns out to be a dependency for future STM32F1xx board manager updates, should not there be some form of dependency checking in the board manager installation process?
I am also interested in information on the gcc/g++ compiler. Is it a single compiler that can compile for different architectures or are there separated gcc/g++ compilers for each architecture? Where are the compiler options configured, etc?