Unable to compile sketch

I'm unable to load my custom sketch on my m5stick but when I tried with default examples it's working fine, I don't know how to resolve this…
I got this error message:

In file included from C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/painlessmesh/ntp.hpp:16,
                 from C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/painlessmesh/mesh.hpp:6,
                 from C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/painlessMeshConnection.h:16,
                 from C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/painlessMesh.h:20,
                 from C:\Users\Pradeep\Desktop\sketch_nov04a\sketch_nov04a.ino:1:
C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/painlessmesh/router.hpp: In function 'void painlessmesh::router::handleNodeSync(T&, painlessmesh::protocol::NodeTree, std::shared_ptr<_Tp>)':
C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/painlessmesh/router.hpp:162:26: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
     mesh.addTask([&mesh, remoteNodeId = newTree.nodeId]() {
                          ^~~~~~~~~~~~
C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/painlessmesh/router.hpp:189:26: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
     mesh.addTask([&mesh, nodeId = newTree.nodeId]() {
                          ^~~~~~
In file included from C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/painlessMesh.h:23,
                 from C:\Users\Pradeep\Desktop\sketch_nov04a\sketch_nov04a.ino:1:
C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp: In member function 'void painlessmesh::wifi::Mesh::eventHandleInit()':
C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp:252:22: error: 'SYSTEM_EVENT_SCAN_DONE' is not a member of 'arduino_event_id_t'
         WiFiEvent_t::SYSTEM_EVENT_SCAN_DONE);
                      ^~~~~~~~~~~~~~~~~~~~~~
C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp:261:22: error: 'SYSTEM_EVENT_STA_START' is not a member of 'arduino_event_id_t'
         WiFiEvent_t::SYSTEM_EVENT_STA_START);
                      ^~~~~~~~~~~~~~~~~~~~~~
C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp:272:22: error: 'SYSTEM_EVENT_STA_DISCONNECTED' is not a member of 'arduino_event_id_t'
         WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Pradeep\Documents\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp:282:22: error: 'SYSTEM_EVENT_STA_GOT_IP' is not a member of 'arduino_event_id_t'
         WiFiEvent_t::SYSTEM_EVENT_STA_GOT_IP);
                      ^~~~~~~~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board M5Stick-C. >

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Please follow the advice and post your sketch using code tags

1 Like

This sketch was actually worked with win10 , but now I'm got this error with win8.1 OS.

#include "painlessMesh.h"
#include <WiFi.h>

#define   MESH_PREFIX     "whateverYouLike"
#define   MESH_PASSWORD   "somethingSneaky"
#define   MESH_PORT       5555


// Replace with your network credentials
const char* ssid     = "ESP32-Access-Point";
const char* password = "123456789";


Scheduler userScheduler; // to control your personal task
painlessMesh  mesh;
// User stub
void sendMessage() ; // Prototype so PlatformIO doesn't complain

Task taskSendMessage( TASK_SECOND * 1 , TASK_FOREVER, &sendMessage );

void sendMessage() {
  String msg = "Hello from node ";
  msg += mesh.getNodeId();
  mesh.sendBroadcast( msg );
  taskSendMessage.setInterval( random( TASK_SECOND * 1, TASK_SECOND * 5 ));
}

// Needed for painless library
void receivedCallback( uint32_t from, String &msg ) {
  Serial.printf("startHere: Received from %u msg=%s\n", from, msg.c_str());
}

void newConnectionCallback(uint32_t nodeId) {
    Serial.printf("--> startHere: New Connection, nodeId = %u\n", nodeId);
}

void changedConnectionCallback() {
  Serial.printf("Changed connections\n");
}

void nodeTimeAdjustedCallback(int32_t offset) {
    Serial.printf("Adjusted time %u. Offset = %d\n", mesh.getNodeTime(),offset);
}

// Set web server port number to 80
WiFiServer server(80);

// Variable to store the HTTP request
String header;


void setup() {
  Serial.begin(115200);
    mesh.setDebugMsgTypes( ERROR | STARTUP );  // set before init() so that you can see startup messages

  mesh.init( MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT );
  mesh.onReceive(&receivedCallback);
  mesh.onNewConnection(&newConnectionCallback);
  mesh.onChangedConnections(&changedConnectionCallback);
  mesh.onNodeTimeAdjusted(&nodeTimeAdjustedCallback);

  userScheduler.addTask( taskSendMessage );
  taskSendMessage.enable();


  // Connect to Wi-Fi network with SSID and password
  Serial.print("Setting AP (Access Point)…");
  // Remove the password parameter, if you want the AP (Access Point) to be open
  WiFi.softAP(ssid, password);

  IPAddress IP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(IP);
  
  server.begin();
}

void loop(){
  WiFiClient client = server.available();   // Listen for incoming clients

  if (client) {                             // If a new client connects,
    Serial.println("New Client.");          // print a message out in the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        header += c;
        if (c == '\n') {                    // if the byte is a newline character
 
          if (currentLine.length() == 0) {
           
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println("Connection: close");
            client.println();
            

            // Display the HTML web page
            client.println("<!DOCTYPE html><html>");
            client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
            client.println("<link rel=\"icon\" href=\"data:,\">");
            
            client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
            //client.println(".button { background-color: #4CAF50; border: none; color: white; padding: 16px 40px;");
            client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
            client.println(".button2 {background-color: #555555;}</style></head>");
            
            // Web Page Heading
            client.println("<body><h1>ESP32 Web Server</h1>");
            

            client.println("</body></html>");
            
            // The HTTP response ends with another blank line
            client.println();
            // Break out of the while loop
            break;
          } else { // if you got a newline, then clear currentLine
            currentLine = "";
          }
        } else if (c != '\r') {  // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }
      }
    }
    // Clear the header variable
    header = "";
    // Close the connection
    client.stop();
    Serial.println("Client disconnected.");
    Serial.println("");
  }
}

and the error message ....

In file included from C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/painlessmesh/ntp.hpp:16,
                 from C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/painlessmesh/mesh.hpp:6,
                 from C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/painlessMeshConnection.h:16,
                 from C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/painlessMesh.h:20,
                 from C:\Users\Pradeep\Desktop\sketch_nov04a\sketch_nov04a.ino:1:
C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/painlessmesh/router.hpp: In function 'void painlessmesh::router::handleNodeSync(T&, painlessmesh::protocol::NodeTree, std::shared_ptr<_Tp>)':
C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/painlessmesh/router.hpp:162:26: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
     mesh.addTask([&mesh, remoteNodeId = newTree.nodeId]() {
                          ^~~~~~~~~~~~
C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/painlessmesh/router.hpp:189:26: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
     mesh.addTask([&mesh, nodeId = newTree.nodeId]() {
                          ^~~~~~
In file included from C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/painlessMesh.h:23,
                 from C:\Users\Pradeep\Desktop\sketch_nov04a\sketch_nov04a.ino:1:
C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp: In member function 'void painlessmesh::wifi::Mesh::eventHandleInit()':
C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp:252:22: error: 'SYSTEM_EVENT_SCAN_DONE' is not a member of 'arduino_event_id_t'
         WiFiEvent_t::SYSTEM_EVENT_SCAN_DONE);
                      ^~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp:261:22: error: 'SYSTEM_EVENT_STA_START' is not a member of 'arduino_event_id_t'
         WiFiEvent_t::SYSTEM_EVENT_STA_START);
                      ^~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp:272:22: error: 'SYSTEM_EVENT_STA_DISCONNECTED' is not a member of 'arduino_event_id_t'
         WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Arduino\libraries\Painless_Mesh\src/arduino/wifi.hpp:282:22: error: 'SYSTEM_EVENT_STA_GOT_IP' is not a member of 'arduino_event_id_t'
         WiFiEvent_t::SYSTEM_EVENT_STA_GOT_IP);
                      ^~~~~~~~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board M5Stick-C.

Seriously? You couldn't find a PC with Vista on it?

Lol… I just downgraded my system!

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