Problems with NETSGPClient - #include <set>

Dear Volks,

I try to start the Demo Code from the NETSGPClient-Lib and I get following Error:
In file included from C:\Users\XXXX\Documents\Arduino\libraries\NETSGPClient\src\AsyncNETSGPClient.cpp:1:0:
C:\Users\XXXX\Documents\Arduino\libraries\NETSGPClient\src\AsyncNETSGPClient.h:3:10: fatal error: set: No such file or directory
#include
^~~~~
compilation terminated.
exit status 1

I tested it on Windows and Linux.
Any hints?
Thanks

OnQueue

This library apparently makes use of the Standard Template Library (STL), which is not available for the AVR platform. It will compile for ESP and SAMD platforms.

There are implementations of the STL out there, but it may be tricky to get them working:

[edit]

The following may work:

  1. Install ArduinoSTL.
  2. Edit ArduinoSTL/src/new_handler.cpp, comment out the first line of code on line 22:
//const std::nothrow_t std::nothrow = { };
  1. Edit NETSGPClient/src/NETSGPClient.cpp, comment out the following check starting on line 197:
    //if (!mStream.find(&header[0], 2))
    //{
    //    DEBUGLN("[findAndReadReply] Could not find header");
    //    return false;
    //}
  1. In the sketch, include ArduinoSTL.h before including AsyncNETSGPClient.h.

The following sketch now compiles.

#include <ArduinoSTL.h>
#include <AsyncNETSGPClient.h>

void setup() {}

void loop() {}

I am not sure why step 2 is needed, but I could not get the STL to work without it. Perhaps you can omit this step.

1 Like

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