Macro_fail: compile error on Zero (and probably other platforms)

I’m still having the same problem, but I am compiling on a Mega using BlynkSimpleEthernet2

I can get a simple version working, but when trying to integrate into my home IOT server, I get this error. The code is simply too large to paste here.

Seems like an issue with the Arduino IDE and templates. Just a guess.

@ClintonK start a thread.

This ADC_MODE(ADC_VCC); is an ESP command, not an Arduino one… in your case you are using the ESP in AT mode which means it is just a simple adapter now and not command accessible as it would be in standalone mode.

Highly unlikely as you hadn’t seen the sketch with the bad line of code when you posted this.

New thread will ALL relevant details.

Forget the ADC_MODE(ADC_VCC); There is not ADC_MODE(ADC_VCC); in my code. That was from a previous poster’s code later down the thread.

I am getting the same compile error that is the topic of this thread on a Mega. ADC_MODE(ADC_VCC); was added later in the thread.

Look above at the entire thread and you’ll see that I did post a reply before the ADC_MODE(ADC_VCC); code example was posted.

Pay attention.

@ClintonK I’d start a new thread and post your code (correctly formatted) and the error messages you’re getting, along with details of what version of the IDE, Blynk libraries etc that you’re using.

Pete.

Same here for you… I moved your issue into a NEW THREAD :stuck_out_tongue_winking_eye:

That is EXACTLY what I said so your “me too” was totally irrelevant in the other thread, it’s YOU that needs to pay attention.

There are thousands of reasons causing compiler errors, almost all due to user error.

Let’s see your buggy sketch formatted with backticks if you want any assistance.

I won’t waste time on you.

Please “help” someone else.

Thank god.

That will be almost impossible based on your effort to date of “my invisible sketch will not compile”.

1 Like

I’ve moved over to a Zero so I don’t take down my server. This code replicates the problem seen on different platforms and produces the compile errors below (code follows). Moving the macro below the #include <BlynkSimpleEthernet2.h>
solves the problem, but that’s a band-aid. On larger projects this can cause problems if multiple libraries start having precedence requirements.

Macro_fail:29: error: variable or field 'BlynkWidgetWrite8' declared void
 BLYNK_WRITE(V8){
                                                           ^
Macro_fail:29: error: 'BlynkReq' was not declared in this scope
 BLYNK_WRITE(V8){
                        ^
Macro_fail:29: error: expected primary-expression before 'const'
 BLYNK_WRITE(V8){
                                                                       ^
exit status 1
variable or field 'BlynkWidgetWrite8' declared void

-- 

The example code
#define RANDOM_MACRO(mode) int empty_function(void) { return (int) (mode); }

#include <SPI.h>
#include <Ethernet2.h>

RANDOM_MACRO(5);  // CAUSES COMPILE ERROR IF IT'S HERE

#include <BlynkSimpleEthernet2.h>

// RANDOM_MACRO(5); // COMPILES IF ITS AFTER #include <BlynkSimpleEthernet2.h>

IPAddress ip(192,168,222, 120 );
const char auth[] = "authorization code";
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
static IPAddress myDns(8,8,8,8);
IPAddress subnet_mask(255, 255, 255,   0);

void setup() {
  Blynk.begin(auth, "blynk-cloud.com", 8442, ip, myDns, mac);
}

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

BLYNK_WRITE(V8){
    int pinValue = param.asInt(); // assigning incoming value from pin V2 to a variable
    Serial.print("V* button value is: ");
    Serial.println(pinValue);
}

And you still forgot to format your posted code :stuck_out_tongue:

Dude, there are reasons for rules… please follow them, politely, if you ever expect assistance.

I edited your code formatting since you are such a nice noob :stuck_out_tongue_winking_eye:

The issue relating to the position of Blynk libraries is being monitored at https://github.com/blynkkk/blynk-library/issues/399 by @vshymanskyy

1 Like