Variable or field 'BlynkWidgetWrite100' declared void

guys, anyone knows what this error means? i try to re-compile an older code (i wrote ~5 months ago). but i’ve got this error:

BLYNK_WRITE:1: error: variable or field 'BlynkWidgetWrite100' declared void

 BLYNK_WRITE(V100)

                                                             ^

BLYNK_WRITE:1: error: 'BlynkReq' was not declared in this scope

 BLYNK_WRITE(V100)

                          ^

BLYNK_WRITE:1: error: expected primary-expression before 'const'

 BLYNK_WRITE(V100)

                                                                         ^

Using library Sonoff at version 2.4.0-rc2-54 in folder: C:\ARDUINO\libraries\Sonoff 
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\libraries\ESP8266WiFi 
Using library ESP8266mDNS in folder: C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\libraries\ESP8266mDNS (legacy)
Using library ArduinoOTA at version 1.0 in folder: C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\libraries\ArduinoOTA 
Using library ESP8266HTTPClient at version 1.1 in folder: C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\libraries\ESP8266HTTPClient 
Using library ESP8266httpUpdate at version 1.1 in folder: C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\libraries\ESP8266httpUpdate 
Using library Blynk at version 0.5.0 in folder: C:\ARDUINO\libraries\Blynk 
Using library Time at version 1.5 in folder: C:\ARDUINO\libraries\Time 
Using library EEPROM at version 1.0 in folder: C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\libraries\EEPROM 
Using library DallasTemperature at version 3.7.9 in folder: C:\ARDUINO\libraries\DallasTemperature 
Using library DHT_sensor_library at version 1.3.0 in folder: C:\ARDUINO\libraries\DHT_sensor_library 
Using library Adafruit_Sensor at version 1.0.2 in folder: C:\ARDUINO\libraries\Adafruit_Sensor 
exit status 1
variable or field 'BlynkWidgetWrite100' declared void

on the V100 i have a “time input” widget, with the following code:

BLYNK_WRITE(V100)
{
  TimeInputParam t(param);

  if (t.hasStartTime()) {                            // Process start time
    armedStartH = t.getStartHour();
    armedStartM = t.getStartMinute();
  }
  else if (t.isStartSunrise()) {}
  else if (t.isStartSunset())  {}

  if (t.hasStopTime()) {                             // Process stop time
    armedStopH = t.getStopHour();
    armedStopM = t.getStopMinute();
  }
  else if (t.isStopSunrise()) {}
  else if (t.isStopSunset())  {}

  for (byte i = 1; i <= 7; i++) {                    // Process weekdays (1. Mon, 2. Tue, 3. Wed)
    if (t.isWeekdaySelected(i)) weekdaySelected[i] = true;
    else weekdaySelected[i] = false;
  }

  terminal.println(" ");
  terminal.flush();
  terminal.println(getTime() + "arm all at " + armedStartH + ":" + armedStartM);
  terminal.flush();
  terminal.println(String("disarm all at ") + armedStopH + ":" + armedStopM);
  terminal.flush();
}

os: win10
ide: 1.8.5
esp core: 2.4.0-rc2
blynk lib: 0.5.0

1 Like

I too have this problem. Do you still get the error when all the code in the function is comments out?

I do.

When removing all the code, it compiles fine here.

Does it happen when you put it on another Vpin, say a very low one, like V10?

Do you mean with an empty BLYNK_WRITE(V100) ?

Yes :slight_smile:

yes!

just tested, yes, it is the same error with V10.

@vshymanskyy, can you give us some hints, what can be the problem, please?

i’ve tried different library versions, different esp core versions, it is still the same. some months ago the same code compiled / worked fine.

@ClintonK are you using an ESP or an Arduino?

If ESP, which core 2.4.0-rc2 like the OP, 2.4.0 or the old 2.3.0?

i’ve tried with both of the above, and also with library 0.4.10 and 0.5.0, it is no difference.

Could you provide a minimal example (full, but short sketch) that illustrates the problem?
No other library dependencies, etc.

@wanek looks to be compiling OK here.

Paste your declarations for:

armedStopH
armedStopM
weekdaySelected

What do you have for getTime()

Confirm Terminal is defined.
Confirm V100 only appears once in your sketch.

Maybe a problem with some of the libraries or the compiler has a problem elsewhere in the sketch.

1 Like

@vshymanskyy, ok, based on the “minimal sketch” idea i’ve done some experiments, and it seems i could isolate / reproduce the problem. so, this is my “minimal sketch” (maybe it could be even more minimal, but it is good to go):

ADC_MODE(ADC_VCC);

#include <ESP8266WiFi.h>          // wifi
#include <BlynkSimpleEsp8266.h>   // blynk library

char auth[] = "YourAuthToken";
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup()
{
  Blynk.begin(auth, ssid, pass);
}

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

BLYNK_WRITE(V101)
{}

and, the cause is the very first line: ADC_MODE(ADC_VCC);
if i comment out this line, it compiles fine. if the line is used, it throws this:

Compiling sketch...
"C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/include" "-IC:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/lwip2/include" "-IC:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\wanek\AppData\Local\Temp\arduino_build_135004/core" -c -Wall -Wextra -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536   -DARDUINO=10805 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_GENERIC"  -DESP8266 "-IC:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266" "-IC:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\variants\generic" "-IC:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\ESP8266WiFi\src" "-IC:\ARDUINO\libraries\Blynk\src" "C:\Users\wanek\AppData\Local\Temp\arduino_build_135004\sketch\blynk_debug_00.ino.cpp" -o "C:\Users\wanek\AppData\Local\Temp\arduino_build_135004\sketch\blynk_debug_00.ino.cpp.o"
blynk_debug_00:20: error: variable or field 'BlynkWidgetWrite101' declared void

 BLYNK_WRITE(V101)

                                                             ^

blynk_debug_00:20: error: 'BlynkReq' was not declared in this scope

 BLYNK_WRITE(V101)

                          ^

blynk_debug_00:20: error: expected primary-expression before 'const'

 BLYNK_WRITE(V101)

                                                                         ^

Using library ESP8266WiFi at version 1.0 in folder: C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\ESP8266WiFi 
Using library Blynk at version 0.5.0 in folder: C:\ARDUINO\libraries\Blynk 
exit status 1
variable or field 'BlynkWidgetWrite101' declared void

@ClintonK, do you have the ADC_MODE(ADC_VCC); line too in your sketch?

@wanek Espressif made some changes for ADC_VCC() in a recent SDK update that is now in 2.4.0 but not in 2.3.0. See if this helps in any way https://github.com/esp8266/Arduino/issues/4282

thanks!

i’ve just read the topic, but i do not understand how is that could cause or solve this compile error?

There have been other compiler issues with that function but should be ok now, see https://github.com/esp8266/Arduino/issues/546

Thanks.
Tracked by

1 Like

I just zoned into this topic and recalled that I have used that ADC_VCC() command before…

But it seems to compile fine for me… Core 2.4.0 (stable) & Blynk 0.5.0… Am I missing the gist of this topic? :thinking:

@Gunner try compiling this:

ADC_MODE(ADC_VCC);

#include <ESP8266WiFi.h>          // wifi
#include <BlynkSimpleEsp8266.h>   // blynk library

char auth[] = "YourAuthToken";
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup()
{
  Blynk.begin(auth, ssid, pass);
}

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

BLYNK_WRITE(V101)
{}

It’s fine without the first line.

I found this old thread about a similar (same?) issue in an older version of the Arduino IDE:

One of the comments is “This seems to be caused by arduino-builder not generating correct forward declarations for functions marked with extern C.”

and this workaround was found:

Add a new Tab with file adc.h
with one line:
ADC_MODE(ADC_VCC)

add
#include "adc.h"
as first include in first tab.

I tried this and the code now compiles:

I’ve not tried tweaking the code to write the voltage readings to Blynk or the serial monitor, so I don’t know if it truly fixes the problem - I need a coffee and some breakfast first! :coffee::fried_egg::bacon:

Pete.

4 Likes

I saw that yesterday too but I believe it was a “bug” in the Arduino IDE that was quickly fixed.

Compiles for me too.

Well, who knows :stuck_out_tongue: If I built the sketch up from top to bottom, it was the last line that stopped it for me.

Still, my sketch with the same ADC_MODE(ADC_VCC); not only compiles, but works…

image


I have had strange compiling errors from something as simple as leaving an IDE open too long (save, close and reopen exact same script and works again)… and even chased issues around for over an hour once, tearing apart multiple scripts, before realising the fault was the latest update of the Dallas 1-wire library… reverted back and everything compiling again.

I am amazed these things work anyhow… so naughty and complex :stuck_out_tongue: