isnan() and isinf() unrecognized
Created by: Slechtvalk
Hi,
compiling ArduinoJSON on MS Visual C++ 2012, I get the following error :
Fehler 1 error C3861: "isnan": Bezeichner wurde nicht gefunden. F:\Variosystem\software\swexternals\software\extern\json\ArduinoJson\src\Arduino\Print.cpp 30 1 ArduinoJson Fehler 2 error C3861: "isinf": Bezeichner wurde nicht gefunden. F:\Variosystem\software\swexternals\software\extern\json\ArduinoJson\src\Arduino\Print.cpp 31 1 ArduinoJson 3 IntelliSense: Der Bezeichner ""isnan"" ist nicht definiert. f:\Variosystem\software\swexternals\software\extern\json\ArduinoJson\src\Arduino\Print.cpp 30 7 ArduinoJson 4 IntelliSense: Der Bezeichner ""isinf"" ist nicht definiert. f:\Variosystem\software\swexternals\software\extern\json\ArduinoJson\src\Arduino\Print.cpp 31 7 ArduinoJson
Translation : isnan() and isinf() are unknown to MS Visual Studio.
My solution :
insert the following above the called functions:
#ifdef _MSC_VER
#include <float.h>
#define isnan(x) _isnan(x)
#define isinf(x) (!_finite(x))
#endif
This will translate the Posix calles to calls MS VC understands.
Ewout