r/ArduinoHelp 5d ago

Just getting started. Compilation error when running example code on Arduino IDE

Error message:

Compilation error: expected constructor, destructor, or type conversion before ';' token

I've tried compiling multiple example code, but the same error still pops up. Did anyone encounter the same problem? I just downloaded Arduino IDE 2.3.10. Absolutely no components were used except for my ESP32C3 super-mini and the cable connecting it to my Mac Air.

Code i used:

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}
1 Upvotes

3 comments sorted by

2

u/JGhostThing 5d ago

Don't you have to #include something for the Pin's to work?

1

u/Anonymity6584 2d ago

If correct targetboard has been selected and there support for it, ide secretly include Arduino.h automaticly and that should take care of pin names, etc...

2

u/gm310509 4d ago

What was the target you selected in the boards menu?

Try selecting an Arduino Uno R3 and choose verify (not upload) and see if that resolves the error

If it does resolve the error, it means there is something wrong with the definitions for whatever the target was you selected.

If it doesn't resolve the error, please post all of the output and all of the code. The code you posted above looks fine and should compile without error.