Code suddenly gives error "Error compiling of board Arduino Mega..."

Hi,

I am working on some IOT project with Blynk.
I am using a WW5500 Ethernet module, it works fine with the Blynk test for enthernet2(it connects to the server).

Yesterday my code compiled fine, but suddenly it gives an error.

 `Arduino:1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board:"Arduino Mega or Mega 2560, 
ATmega2560 (Mega 2560)"

In file included from C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkApi.h:16:0,

             from C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/BlynkApiArduino.h:14,

             from C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Adapters/BlynkEthernet.h:24,

             from C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEthernet2.h:20,

             from C:\Users\Isaak\Desktop\Arduino_Ethernet2\Arduino_Ethernet2.ino:4:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h: In instantiation of void 
BlynkParam::add_multi(T) [with T = float (*)(); Args = {}]:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkApi.h:81:9:   required from void 
BlynkApi<Proto>::virtualWrite(int, Args ...) [with Args = {float (*)()}; Proto = 
BlynkProtocol<BlynkArduinoClientGen<Client> >]'

C:\Users\Isaak\Desktop\Arduino_Ethernet2\Arduino_Ethernet2.ino:128:40:   required from here

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:112:9: error: no matching 
function for call to add(float (*&)())

     add(last);

     ^~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:231:10: note: candidate: 
void BlynkParam::add(int) <near match>

 void BlynkParam::add(int value)

      ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:231:10: note:   
conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:239:10: note: candidate: 
void BlynkParam::add(unsigned int) <near match>

 void BlynkParam::add(unsigned int value)

      ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:239:10: note:   
conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:247:10: note: candidate: 
 void BlynkParam::add(long int) <near match>

 void BlynkParam::add(long value)

      ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:247:10: note:   
conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:255:10: note: candidate: 
 void BlynkParam::add(long unsigned int) <near match>

 void BlynkParam::add(unsigned long value)

      ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:255:10: note:   
conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:263:10: note: candidate: 
void BlynkParam::add(long long int) <near match>

 void BlynkParam::add(long long value)  // TODO: this currently adds just a long

      ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:263:10: note:   
conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:271:10: note: candidate: 
void BlynkParam::add(long long unsigned int) <near match>

 void BlynkParam::add(unsigned long long value) // TODO: this currently adds just a long

      ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:271:10: note:   
conversion of argument 1 would be ill-formed:

exit status 1

Fout bij het compileren voor board Arduino Mega or Mega 2560`

It looks like it has to do with the library, but i didn’t mess with it.
I recompiled it many times (some other topics said that that might work).
I deleted and reinstalled the lib, but without success.

If anyone knows how to solve this issue, i would really appreciate it!

Isaak

The title of your topic is “New Wemos D1 mini keeps disconecting form the blynk cloud”. yet you aren’t using a Wemos D1 Mini, and your issue is that you can’t get your sketch to compile as opposed to your device keeps disconnecting.
What’s this all about?

We need to see your code, and when you post it you MUST format it correctly by placing triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
Copy and past these exact characters if necessary.

If you post incorrectly formatted code it will be deleted.

Pete.

Sorry, it was a draft that i made for another issue, and i forgot to change the title…

here is my code:

//U8lib
#include <U8glib.h>
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_FAST);
void draw() {
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 20);
  u8g.print("Hello World!");
}
void U8glib_print() {
  u8g.firstPage();
  do {
    draw();
  } while ( u8g.nextPage() );
}

// KEYPAD
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
  {'1', '2', '3', '4'},
  {'5', '6', '7', '8'},
  {'9', 'A', 'B', 'C'},
  {'D', 'E', 'F', 'G'}
};
byte rowPins[ROWS] = {29, 27, 25, 23};
byte colPins[COLS] = {22, 24, 26, 28};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
char Keypad_return() {
  char customKey = customKeypad.getKey();
  if (customKey) {
    return customKey;
  }
}
bool Keypad_ask(char ask) {
  char customKey = customKeypad.getKey();
  if (customKey == ask) {
    return LOW;
  }
  else {
    return HIGH;
  }
}



//DHT
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 48
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);

float DHT_return(char selector = 'H') {
  sensors_event_t event;
  dht.temperature().getEvent(&event);
  if ( selector == 'H') {
    if (isnan(event.temperature)) {
    }
    else {
      return event.temperature;
    }
  }
  else if ( selector == 'T') {
    sensors_event_t event;
    dht.humidity().getEvent(&event);
    if (isnan(event.relative_humidity)) {
    }
    else {
      return event.relative_humidity;
    }
  }
}

//BH1750
#include <BH1750.h>
BH1750 lightMeter;
float BH1750_return() {
  return lightMeter.readLightLevel() * 10;
}

//BMP
#include <Wire.h>
#include "SparkFunBME280.h"
BME280 BMP;
float BMP_return(char selector = 'T') {
  if (selector == 'T') {
    return BMP.readTempC();
  } else if (selector == 'F') {
    return BMP.readTempF();
  } else if (selector == 'H') {
    return BMP.readFloatHumidity();
  } else if (selector == 'P') {
    return BMP.readFloatPressure();
  }
}

//RELAY
byte relay[4] = {34, 35, 36, 37};

// EEPROM
#include <EEPROM.h>
#define SETTINGS_AMOUNT 1
byte currentSettings[SETTINGS_AMOUNT];

void updateSettings() {
  for (int i = 0; i < SETTINGS_AMOUNT; i++) {
    EEPROM.update(i, currentSettings[i]);
  }
}
void getSettings() {
  for (int i = 0; i < SETTINGS_AMOUNT; i++) {
   currentSettings[i] = EEPROM.read(i);
  }
}

//BlynkTimer timer;
//#include <Blynk.h>
#include <SPI.h>
#include <Ethernet2.h>
#include <BlynkSimpleEthernet2.h>
//#define BLYNK_PRINT Serial
//BlynkTimer timer;
char auth[] = ""; //I removed it (but the right one was here!)

void myTimerEvent() {
  Blynk.virtualWrite(V10, BMP_return('T'));
  Blynk.virtualWrite(V12, BH1750_return);
}



void setup() {
  Serial.begin(9600);

  Blynk.begin(auth);
  //timer.setInterval(1000L, myTimerEvent);

  dht.begin();
  lightMeter.begin();
  BMP.setI2CAddress(0x76);
  if (BMP.beginI2C() == false) Serial.println("BMP connect failed");

  getSettings();

}

void loop() {
  Blynk.run();
}

Isaak

That’s part of your code, but not enough to allow anyone to compile it.

Pete.

What doe you mean? Thats the full code… device is an Arduino mega.
Do you need the blynk widgets?

I assumed that some of the .h files were tabs that include custom code.
If not then I doubt that many people will be willing to go and track down these libraries and install them so that they can compile your code for you to see if they experience the same error.

Pete.

The error is in one of the Blynk libraries, I tested it and if I delete all the other libraries and code that has nothing to do with blynk. and it still gave that error message.

whats true tho is that I created 4 tabs (was simpeler to edit things), the code that you see is the same code but in one tab… (the code i posted gave the same error as the origenal).

Isaak

If the Blynk example for the W5500 compiles correctly then don’t you think that it points to an issue with your code as opposed to an issue with the Blynk library installation?

If there is a library issue then it’s probably going to be with the Ethernet2 library.
This should be installed via the IDE’s Library Manager which will normally place the files in Documents > Arduino > libraries > Ethernet2, but your appear to be on your desktop…

Pete.

Ah, that file is just a copy of the example… and I temporary stored it on my desktop.

The library is correct installed:
ethernet screen

Edit: Reinstalling the Ethernet2 library did not fix it.

Isaak

for anyone intrested in how it is solved click here