Build Error with SDFat 1.0.16 and Photon on Workbench

n file included from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/lib/SdFat/src/FatLib/FatLibConfig.h:140:0,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/lib/SdFat/src/FatLib/BaseBlockDriver.h:27,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/lib/SdFat/src/BlockDriver.h:31,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/lib/SdFat/src/SdFat.h:32,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/src/powerhub2.ino:287:
./inc/Arduino.h:22:2: error: #error isnan is not defined please ensure this header is included before any STL headers
 #error isnan is not defined please ensure this header is included before any STL headers
  ^
In file included from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/lib/SdFat/src/FatLib/FatLibConfig.h:140:0,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/lib/SdFat/src/FatLib/BaseBlockDriver.h:27,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/lib/SdFat/src/BlockDriver.h:31,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/lib/SdFat/src/SdFat.h:32,
                 from /Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/powerhub207/src/powerhub2.ino:287:
./inc/Arduino.h:203:1: error: expected ';' before 'using'
 using std::isinf
 ^
./inc/Arduino.h:240:1: error: expected ';' before 'typedef'
 typedef USARTSerial HardwareSerial;

Could anyone chip in with what is causing these errors. I have recently moved the code from web IDE where it was building fine.

Probably a missing #include <math.h> somewhere.

#include "math.h"

#ifndef isnan

#error isnan is not defined please ensure this header is included before any STL headers

#endif

This appears to be already included in the “Arduino.h” file?

@armor, which deviceOS version are you compiling to? I just compiled printbenchmark.ino example targeting the Photon and DeviceOS 1.4.4 without any error.

Photon and DeviceOS 1.4.4

I am surprised as well.

I am thinking that the project needs to be recreated since I had a very odd ‘hang’ just when entering the project name.

[Update] I tried that as I noticed that under .vscode folder the launch.json file was missing.
Unfortunately, that didn’t make any difference. So I am back to situation with above 3 errors in Arduino.h and 1 error that I had solved but similarly I am surprised to get, namely F_CPU not defined. I had solved this earlier with a

#ifndef F_CPU
#define F_CPU 120000000
#endif
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-powerhub/lib/SdFat/src/SdCard/SdInfo.h:112:34: error: 'F_CPU' was not declared in this scope
 #define SPI_HALF_SPEED SD_SCK_HZ(F_CPU/4)
                                  ^
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-powerhub/lib/SdFat/src/SdCard/SdInfo.h:104:41: note: in definition of macro 'SD_SCK_HZ'
 #define SD_SCK_HZ(maxSpeed) SPISettings(maxSpeed, MSBFIRST, SPI_MODE0)
                                         ^
/Users/wjsteen/Documents/Intelligent_Furniture_Project/VSC_Projects/zioxi-powerhub/src/zioxi-powerhub.ino:6909:25: note: in expansion of macro 'SPI_HALF_SPEED'
     if (!sd.begin(sdcs, SPI_HALF_SPEED))

@armor, I compiled the example without any modifications except for the chipSelect declaration which I set to A2. You may want to reset your environment. If you can share your project file, I can try to compile it.

I tried re-ordering the #includes - it appears that the build is very sensitive to the order and that what worked with webIDE and cloud compile does not work for local compile!

I then hit a problem with a macro used in Adafruit_mfGFX called swap() that clashed with something in the Standard Library - renamed macro to _swap(). Then a problem with F_CPU not defined - fixed that and now

Thanks for support.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.