title: Error while compiling InfluxDB library for ESP32
body: <p>newbie here.
  I am trying to compile the BasicWrite.ino example in the InfluxDB library for a ESP32 Dev board for personal project. The code is:</p>
  <pre><code> * Basic Write Example code for InfluxDBClient library for Arduino
   * Data can be immediately seen in a InfluxDB UI: wifi_status measurement
   * Enter WiFi and InfluxDB parameters below
   *
   * Measures signal level of the actually connected WiFi network
   * This example supports only InfluxDB running from unsecure (http://...)
   * For secure (https://...) or Influx Cloud 2 use SecureWrite example
   **/
  
  #if defined(ESP32)
  #include &lt;WiFiMulti.h&gt;
  WiFiMulti wifiMulti;
  #define DEVICE &quot;ESP32&quot;
  #elif defined(ESP8266)
  #include &lt;ESP8266WiFiMulti.h&gt;
  ESP8266WiFiMulti wifiMulti;
  #define DEVICE &quot;ESP8266&quot;
  #endif
  
  #include &lt;InfluxDbClient.h&gt;
  
  // WiFi AP SSID
  #define WIFI_SSID &quot;ssid&quot;
  // WiFi password
  #define WIFI_PASSWORD &quot;password&quot;
  // InfluxDB  server url. Don't use localhost, always server name or ip address.
  // E.g. http://192.168.1.48:8086 (In InfluxDB 2 UI -&gt; Load Data -&gt; Client Libraries), 
  #define INFLUXDB_URL &quot;influxdb-url&quot;
  // InfluxDB 2 server or cloud API authentication token (Use: InfluxDB UI -&gt; Load Data -&gt; Tokens -&gt; &lt;select token&gt;)
  #define INFLUXDB_TOKEN &quot;toked-id&quot;
  // InfluxDB 2 organization id (Use: InfluxDB UI -&gt; Settings -&gt; Profile -&gt; &lt;name under tile&gt; )
  #define INFLUXDB_ORG &quot;org&quot;
  // InfluxDB 2 bucket name (Use: InfluxDB UI -&gt; Load Data -&gt; Buckets)
  #define INFLUXDB_BUCKET &quot;bucket&quot;
  // InfluxDB v1 database name 
  //#define INFLUXDB_DB_NAME &quot;database&quot;
  
  // InfluxDB client instance
  InfluxDBClient client(INFLUXDB_URL, INFLUXDB_ORG, INFLUXDB_BUCKET, INFLUXDB_TOKEN);
  // InfluxDB client instance for InfluxDB 1
  //InfluxDBClient client(INFLUXDB_URL, INFLUXDB_DB_NAME);
  
  // Data point
  Point sensor(&quot;wifi_status&quot;);
  
  void setup() {
    Serial.begin(115200);
  
    // Connect WiFi
    Serial.println(&quot;Connecting to WiFi&quot;);
    WiFi.mode(WIFI_STA);
    wifiMulti.addAP(WIFI_SSID, WIFI_PASSWORD);
    while (wifiMulti.run() != WL_CONNECTED) {
      Serial.print(&quot;.&quot;);
      delay(500);
    }
    Serial.println();
  
    // Set InfluxDB 1 authentication params
    //client.setConnectionParamsV1(INFLUXDB_URL, INFLUXDB_DB_NAME, INFLUXDB_USER, INFLUXDB_PASSWORD);
  
    // Add constant tags - only once
    sensor.addTag(&quot;device&quot;, DEVICE);
    sensor.addTag(&quot;SSID&quot;, WiFi.SSID());
  
    // Check server connection
    if (client.validateConnection()) {
      Serial.print(&quot;Connected to InfluxDB: &quot;);
      Serial.println(client.getServerUrl());
    } else {
      Serial.print(&quot;InfluxDB connection failed: &quot;);
      Serial.println(client.getLastErrorMessage());
    }
  }
  
  void loop() {
    // Store measured value into point
    sensor.clearFields();
    // Report RSSI of currently connected network
    sensor.addField(&quot;rssi&quot;, WiFi.RSSI());
    // Print what are we exactly writing
    Serial.print(&quot;Writing: &quot;);
    Serial.println(client.pointToLineProtocol(sensor));
    // If no Wifi signal, try to reconnect it
    if (wifiMulti.run() != WL_CONNECTED) {
      Serial.println(&quot;Wifi connection lost&quot;);
    }
    // Write point
    if (!client.writePoint(sensor)) {
      Serial.print(&quot;InfluxDB write failed: &quot;);
      Serial.println(client.getLastErrorMessage());
    }
  
    //Wait 10s
    Serial.println(&quot;Wait 10s&quot;);
    delay(10000);
  }
  </code></pre>
  <p>Here is what I got:</p>
  <pre><code>
  C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp: In member function 'bool InfluxDBClient::init()':
  
  C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp:150:28: error: 'class WiFiClientSecure' has no member named 'setInsecure'
  
               wifiClientSec-&gt;setInsecure();
  
                              ^
  
  C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp: In function 'String escapeJSONString(String&amp;)':
  
  C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp:714:18: error: 'begin' was not declared in this scope
  
       for (char c: value)
  
                    ^
  
  C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp:714:18: note: suggested alternative:
  
  In file included from c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\string:51:0,
  
                   from c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\random:40,
  
                   from c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\bits\stl_algo.h:66,
  
                   from c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\algorithm:62,
  
                   from C:\Users\zjwa1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\cores\esp32/Arduino.h:148,
  
                   from C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.h:32,
  
                   from C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp:27:
  
  c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\bits\range_access.h:87:5: note:   'std::begin'
  
       begin(_Tp (&amp;__arr)[_Nm])
  
       ^
  
  C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp:714:18: error: 'end' was not declared in this scope
  
       for (char c: value)
  
                    ^
  
  C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp:714:18: note: suggested alternative:
  
  In file included from c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\string:51:0,
  
                   from c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\random:40,
  
                   from c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\bits\stl_algo.h:66,
  
                   from c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\algorithm:62,
  
                   from C:\Users\zjwa1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\cores\esp32/Arduino.h:148,
  
                   from C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.h:32,
  
                   from C:\Users\zjwa1\Documents\Arduino\libraries\InfluxDB-Client-for-Arduino-master\src\InfluxDbClient.cpp:27:
  
  c:\users\zjwa1\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\bits\range_access.h:97:5: note:   'std::end'
  
       end(_Tp (&amp;__arr)[_Nm])
  
       ^
  
  exit status 1
  Error compiling for board ESP32 Dev Module.
  
  This report would have more information with
  &quot;Show verbose output during compilation&quot;
  option enabled in File -&gt; Preferences.
  </code></pre>
  <p>I leave out the wifi, etc settings. Shouldn't matter here.
  The library I am using is the current 3.8.0 version.
  Any help would be greatly appreciated. Thanks.</p>