Compilation error - used to work - struct as function parameter

This used to work... then suddenly stopped compiling... super minimal sketch still doesn't compile... any ideas?

struct DataEntry {
  uint32_t timestamp;
  uint8_t switchNumber;
  uint8_t switchState;
};

DataEntry myData;

void setup() {

}

void loop() {

}

void storeData (DataEntry dataEntry) {
  
}

Compiler output:

Arduino: 1.8.7 (Linux), Board: "Arduino Nano, ATmega328P"

sketch_oct27a:15:16: error: variable or field 'storeData' declared void
 void storeData (DataEntry dataEntry) {
                ^
sketch_oct27a:15:16: error: 'DataEntry' was not declared in this scope
exit status 1
variable or field 'storeData' declared void

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I'm baffled. This function used to compile just fine and as far as I know is perfectly valid C++, then I made some changes in my actual sketch, and compilation started to fail. This super minimal sketch also fails, same error message.

Some research told me that the real issue the compiler has is that type DataEntry is not declared, but it definitely is!

What could possibly be wrong?

Code compiles just fine for me; Arduino 1.8.7 on OS X.

As said it USED to compile for me.
Restarted the IDE already, no luck.
Copied to new sketch (clean directory), fail.
Tried new struct, fail.
So I guess some temporary file got in the way - but what/where??

Arduino 1.8.7 / Linux Mint

You can try

void storeData (struct DataEntry dataEntry) {
  
}

Reason is possibly that the Arduino builder puts a prototype before the definition of the struct.

After what change did it stop compiling? IDE version update?

sterretje:
. . .
Reason is possibly that the Arduino builder puts a prototype before the definition of the struct.

That looks like it. In sloeber (which will use the same build mechanism), the generated .cpp looks like this:

#ifdef __IN_ECLIPSE__
//This is a automatic generated file
//Please do not modify this file
//If you touch this file your change will be overwritten during the next build
//This file has been generated on 2018-10-27 08:49:55

#include "Arduino.h"

void storeData(DataEntry dataEntry) ;
void setup() ;
void loop() ;


#include "BareMinimum.ino"  // this is wvmarle's file

#endif

I just installed 1.8.7 on Windows and the code from the original post compiles without error.

The IDE bugged me about my Arduino AVR Boards being out-of-date. I let it upgrade that. Could your Arduinio AVR Boards be out-of-date?

The problem appeared after making multiple changes to my sketch. First I suspected a missing ; or } or so somewhere (the usual culprit of weird errors) but that wasn't the case. After commenting out basically everything it still didn't compile!

Well, I finally found out what caused the problem.

The sketch as posted in OP I managed to compile after I logged off and logged on again (apparently indeed some temp file that got in the way and that got cleared that way). So that was good progress. Then back to my original sketch, and

I have a function:

void setupWebsite() {
  // Enable some callbacks for the web server.
}

And another one:

void setupLogging() {
}

As soon as I enable either function in code (empty body), compilation fails. Renaming the function to beginLogging(), no problem. So the issue is the name of the function itself: as soon as it starts with setup the compiler trips somehow. Same if I rename the second to loggingsetup(), it fails. Naming it loggingSetup() and there is no problem.

I named them setupLogging and setupWebsite as this were functions called from setup()...

I can't reproduce this in my minimal sketch - that one compiles just fine - so there must be more to my sketch that triggers this bug, as that's what I think it is: a bug in the Arduino environment.

Boards are up to date, and I'm trying to compile for ESP8266 (NodeMCU). Should have mentioned that part. Can't compile for Arduino due to missing ESP8266 specific libraries (web server and so).

When testing my minimal sketch it failed on both.

wvmarle:
Renaming the function to beginLogging(), no problem.

That is usually indicative of macro trouble.

Right... but definitely not from myself, as I don't use macros in that sketch.

So that would mean some library has something like

#define setup something

?

Same sketch had more trouble: the WiFiManager type can not be found if the library is included in the file it's used (sketch is split in five separate files), but no issues if it's at the top of the primary .ino - it's a callback function so I guess this has to do with unexpected order of compilation.

This sounds similar to Non-class function prototypes are sometimes inserted inside class definition. · Issue #292 · arduino/arduino-builder · GitHub.

Could be - I haven't found a way to reproduce my problem in a small sketch, but indeed it was the "setup" substring in the function names that caused the trouble.

oqibidipo:
This sounds similar to Non-class function prototypes are sometimes inserted inside class definition. · Issue #292 · arduino/arduino-builder · GitHub.

And this...

Indeed. Looks like the same (kind of) issue. Thanks for the info!

Very frustrating, cost me a few hours of hair pulling as of course I assume the fault is with me, after all so far compiler errors have always been my own fault. Also no idea really what to look for or what could be the actual problem (hence the rather nondescript subject).

1.8.7 seems to be a big disaster. Glad I'm still on 1.8.5.

I upgraded from another 1.8.something as it was every time doing a full recompile (something like "parameters changed, recompiling all), so compiling of just a small change took ages. Which also was very frustrating.

sterretje:
1.8.7 seems to be a big disaster. Glad I'm still on 1.8.5.

Seems like every 15th or 20th version goes from maximum stability to full o' bugs. Wasn't there also an issue with 1.65 and 1.67 or so?

Is this all to add some feature made necessary by hardware upgrades?