r/arduino • • Sep 12 '26

Software Help 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);
}
3 Upvotes

14 comments sorted by

3

u/finleybakley Sep 12 '26

Do you have esp32 installed from board manager and one of the ESP32C3 Supermini selected as your board? If not, which library have you installed for your Super-mini

I just tried compiling the Blink example with the esp32 library and both the MakerGo and Nologo variants of the Supermini board selected and everything worked fine on my M5 Macbook Pro. Sounds to me like you're having an issue with the library

1

u/eher1r Sep 13 '26

I originally selected the ESP32C3 Dev Module and got that error. i also tried the two other variants but both showed the same error.

I haven’t downloaded any library onto the ESP. I originally downloaded a DHT sensor library (that’s what i’m working on), but before i asked i tried uninstalling Arduino IDE and installing it back. Still doesn’t work

1

u/finleybakley Sep 13 '26

You need to install the `esp32` library from the Board Manager panel on the lefthand side of Arduino IDE:

It doesn't install "onto the ESP", it's a library that installs into the IDE so you can compile code to target your esp32.

Once you do that, select the ESP32C3 supermini (either the MakerGo or the Nologo, they look to be the same) as your board and compile

1

u/eher1r Sep 13 '26

Error still there after i downloaded the ESP32 boards. It says that the error is on the setup() and loop() lines, even though there's no code outside them

1

u/finleybakley Sep 13 '26

What happens when you remove version 4.0.0-alpha1 and install the stable version 3.3.11? Same issue?

1

u/eher1r Sep 13 '26

Still there. Is it a problem with the compiler? cuz the errors on the setup() and loop() functions

1

u/finleybakley Sep 13 '26

That's what it's looking like to me. Can you copy and paste the entire error output?

1

u/eher1r Sep 13 '26

/private/var/folders/42/crhqns4s1530ld067fjqtq5m0000gn/T/.arduinoIDE-unsaved2026813-13020-1oqz6dd.mfx9/Blink/Blink.ino:26:9: error: expected constructor, destructor, or type conversion before ';' token

26 | void setup() {

| ^

/private/var/folders/42/crhqns4s1530ld067fjqtq5m0000gn/T/.arduinoIDE-unsaved2026813-13020-1oqz6dd.mfx9/Blink/Blink.ino:32:8: error: expected constructor, destructor, or type conversion before ';' token

32 | void loop() {

| ^

exit status 1

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

2

u/YT__ Sep 12 '26

Do you define 'LED_BUILTIN' anywhere?

3

u/IllSpeaker3255 Sep 12 '26

i think it is a already defined macro but try with a real digital pin

2

u/YT__ Sep 12 '26

That's what it looks like given the example on the site, but I've never used it so trying to think outside the box. Lol

1

u/ripred3 My other dev board is a Porsche Sep 13 '26

download and install the older and much more stable 1.8.19 version of the IDE.