Arduino and PlatformIO compile error with ThingerTinyGSM.h

Hello Community!
I was first successfully compile and upload a simple LED Sketch in Arduino 2.0 and PlatformIO. Now trying a simple example Code with GSM. Tried some different Lib-Versions like 2.17 and 2.21.1 and 2.26 but got a lot of errors!

I´m using a Mega2560 Arduino and a SIM808 Module which works fine with TinyGSM lib.

main.cpp

//#include <Arduino.h>

#define THINGER_SERIAL_DEBUG

// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_M590

// Can be installed from Library Manager or https://github.com/vshymanskyy/TinyGSM
#include <TinyGsmClient.h>
#include <ThingerTinyGSM.h>
#include "arduino_secrets.h"

// Emulate Serial1 on pins 10/11 if HW is not present (use interrupt pin in RX for better performance)
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(10, 11); // RX, TX
#endif

ThingerTinyGSM thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1);

void setup() {
  // open serial for debugging
  Serial.begin(115200);

  // Serial for AT commands (can be higher with HW Serial, or even lower in SW Serial)
  Serial1.begin(115200);

  // set APN (you can remove user and password from call if your apn does not require them)
  thing.setAPN(APN_NAME, APN_USER, APN_PSWD);

  // set PIN (optional)
  // thing.setPIN(CARD_PIN);

  // resource input example (i.e, controlling a digitalPin);
  pinMode(LED_BUILTIN, OUTPUT);
  thing["led"] << digitalPin(LED_BUILTIN);

  // resource output example (i.e. reading a sensor value)
  thing["millis"] >> outputValue(millis());

  // more details at http://docs.thinger.io/arduino/
}

void loop() {
  thing.handle();
}

errors from Arduino IDE 2.2.1

In file included from c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/thinger/thinger.h:29:0,
                 from c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:29,
                 from c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:28,
                 from C:\Users\Andre\Documents\Arduino\thinger_test\thinger_test.ino:14:
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/thinger/thinger_resource.hpp:106:10: error: 'function' in namespace 'std' does not name a template type
     std::function<void()> then_;
          ^~~~~~~~
In file included from c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:29:0,
                 from c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:28,
                 from C:\Users\Andre\Documents\Arduino\thinger_test\thinger_test.ino:14:
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/thinger/thinger.h: In member function 'void thinger::thinger::handle_request_received(thinger::thinger_message&)':
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/thinger/thinger.h:611:57: error: 'class thinger::thinger_resource' has no member named 'then'
                                         thing_resource->then();
                                                         ^~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/thinger/thinger.h:624:37: error: 'class thinger::thinger_resource' has no member named 'then'
                     thing_resource->then();
                                     ^~~~
In file included from c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:28:0,
                 from C:\Users\Andre\Documents\Arduino\thinger_test\thinger_test.ino:14:
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: At global scope:
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:545:34: error: 'std::function' has not been declared
     void set_state_listener(std::function<void(THINGER_STATE)> state_listener){
                                  ^~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:545:42: error: expected ',' or '...' before '<' token
     void set_state_listener(std::function<void(THINGER_STATE)> state_listener){
                                          ^
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:561:10: error: 'function' in namespace 'std' does not name a template type
     std::function<void(THINGER_STATE)> state_listener_;
          ^~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'virtual void ThingerClient::run_reboot()':
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:369:20: error: 'WDTO_15MS' was not declared in this scope
         wdt_enable(WDTO_15MS);
                    ^~~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:369:9: error: 'wdt_enable' was not declared in this scope
         wdt_enable(WDTO_15MS);
         ^~~~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:369:9: note: suggested alternative: 'mutable'
         wdt_enable(WDTO_15MS);
         ^~~~~~~~~~
         mutable
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'virtual void ThingerClient::thinger_state_listener(ThingerClient::THINGER_STATE)':
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:433:12: error: 'state_listener_' was not declared in this scope
         if(state_listener_) state_listener_(state);
            ^~~~~~~~~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:433:12: note: suggested alternative: 'set_state_listener'
         if(state_listener_) state_listener_(state);
            ^~~~~~~~~~~~~~~
            set_state_listener
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'void ThingerClient::set_state_listener(int)':
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:546:9: error: 'state_listener_' was not declared in this scope
         state_listener_ = state_listener;
         ^~~~~~~~~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:546:9: note: suggested alternative: 'set_state_listener'
         state_listener_ = state_listener;
         ^~~~~~~~~~~~~~~
         set_state_listener
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:546:27: error: 'state_listener' was not declared in this scope
         state_listener_ = state_listener;
                           ^~~~~~~~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:546:27: note: suggested alternative: 'set_state_listener'
         state_listener_ = state_listener;
                           ^~~~~~~~~~~~~~
                           set_state_listener
In file included from C:\Users\Andre\Documents\Arduino\thinger_test\thinger_test.ino:14:0:
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h: At global scope:
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:123:30: error: 'std::function' has not been declared
     void setModuleReset(std::function<void()> module_reset){
                              ^~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:123:38: error: expected ',' or '...' before '<' token
     void setModuleReset(std::function<void()> module_reset){
                                      ^
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:138:10: error: 'function' in namespace 'std' does not name a template type
     std::function<void()> module_reset_;
          ^~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h: In member function 'virtual bool ThingerTinyGSM::connect_network()':
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:59:12: error: 'module_reset_' was not declared in this scope
         if(module_reset_) module_reset_();
            ^~~~~~~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:59:12: note: suggested alternative: 'setModuleReset'
         if(module_reset_) module_reset_();
            ^~~~~~~~~~~~~
            setModuleReset
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h: In member function 'void ThingerTinyGSM::setModuleReset(int)':
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:124:9: error: 'module_reset_' was not declared in this scope
         module_reset_ = module_reset;
         ^~~~~~~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:124:9: note: suggested alternative: 'setModuleReset'
         module_reset_ = module_reset;
         ^~~~~~~~~~~~~
         setModuleReset
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:124:25: error: 'module_reset' was not declared in this scope
         module_reset_ = module_reset;
                         ^~~~~~~~~~~~
c:\Users\Andre\Documents\Arduino\libraries\thinger.io\src/ThingerTinyGSM.h:124:25: note: suggested alternative: 'setModuleReset'
         module_reset_ = module_reset;
                         ^~~~~~~~~~~~
                         setModuleReset

exit status 1

Compilation error: exit status 1

platformio.ini

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
monitor_speed = 115200
lib_deps =
    ;thinger-io/thinger.io @ ~2.21.1
    https://github.com/vshymanskyy/TinyGSM
    https://github.com/thinger-io/Arduino-Library

please can someone put me in the right direction?

I just tried with the thinger.io lib V2.17.0 and Arduino-IDE 2.2.1 and it compiles! In Platformio V2.17.0 is not available.
Any suggestions?

Hi,

If the version is not available at the repository, I would recommend to find the folder and add it by the manual way → How integrate external personal .zip libraries - Libraries - PlatformIO Community.

Hope this helps.