ESP32 C3 - Keeps giving this error

Hi!

Sorry to bother you. I have successfully run code on a ESP32 C3 mini and IDE on an old Windows laptop. I recently bought a new Macbook, installed the IDE for Apple Silicon and all of a sudden I get this error when compiling. Can anybody help me how to fix this? (I'm good with Windows CMD, I'm terrible with Apple terminal commands)

This is the code I use for testing:

void setup() {
  Serial.begin(115200);
  Serial.println("ESP32-C3 test sketch running");
}

void loop() {
  delay(1000);
  Serial.println("Looping...");
}

This is the error I'm getting:

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

Is that the full error message ?
Have you got verbose reporting for compiling turned on in the IDE Preferences ?

Here's the full message:

/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST/TEST.ino:1:9: error: expected constructor, destructor, or type conversion before ';' token
1 | void setup() {
| ^
/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST/TEST.ino:6:8: error: expected constructor, destructor, or type conversion before ';' token
6 | void loop() {
| ^
exit status 1

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

I'm not familiar with 'Verbose reporting for compiling' - I'll turn it on and see what happens.

With Verbose turned on:

FQBN: esp32:esp32:esp32c3
Using board 'esp32c3' from platform in folder: /Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0
Using core 'esp32' from platform in folder: /Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0

/usr/bin/env bash -c "[ ! -f \"/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST\"/partitions.csv ] || cp -f \"/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST\"/partitions.csv \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/partitions.csv"
/usr/bin/env bash -c "[ -f \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/partitions.csv ] || [ ! -f \"/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/variants/esp32c3\"/partitions.csv ] || cp \"/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/variants/esp32c3\"/partitions.csv \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/partitions.csv"
/usr/bin/env bash -c "[ -f \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/partitions.csv ] || cp \"/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0\"/tools/partitions/default.csv \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/partitions.csv"
/usr/bin/env bash -c "[ -f \"/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST\"/bootloader.bin ] && cp -f \"/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST\"/bootloader.bin \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/TEST.ino.bootloader.bin || ( [ -f \"/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/variants/esp32c3\"/bootloader.bin ] && cp \"/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/variants/esp32c3\"/bootloader.bin \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/TEST.ino.bootloader.bin || \"/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esptool_py/4.9.dev3\"/esptool --chip esp32c3 elf2image --flash_mode dio --flash_freq 80m --flash_size 4MB -o \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/TEST.ino.bootloader.bin \"/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3\"/bin/bootloader_qio_80m.elf )"
esptool.py v4.8.1
Creating esp32c3 image...
Merged 2 ELF sections
Successfully created esp32c3 image.
/usr/bin/env bash -c "[ ! -f \"/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST\"/build_opt.h ] || cp -f \"/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST\"/build_opt.h \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/build_opt.h"
/usr/bin/env bash -c "[ -f \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/build_opt.h ] || : > \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/build_opt.h"
/usr/bin/env bash -c ": > '/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/file_opts'"
/usr/bin/env bash -c "cp -f \"/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3\"/sdkconfig \"/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477\"/sdkconfig"
Detecting libraries used...
/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp-rv32/2411/bin/riscv32-esp-elf-g++ -c @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/cpp_flags -w -Os -Werror=return-type -w -x c++ -E -CC -DF_CPU=160000000L -DARDUINO=10607 -DARDUINO_ESP32C3_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32C3_DEV" -DARDUINO_VARIANT="esp32c3" -DARDUINO_PARTITION_default -DARDUINO_HOST_OS="macosx" -DARDUINO_FQBN="esp32:esp32:esp32c3:UploadSpeed=921600,CDCOnBoot=default,CPUFreq=160,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=none,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/defines -I/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST -iprefix /Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/include/ @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/includes -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/qio_qspi/include -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/cores/esp32 -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/variants/esp32c3 @/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/build_opt.h @/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/file_opts /Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/sketch/TEST.ino.cpp -o /dev/null
Generating function prototypes...
/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp-rv32/2411/bin/riscv32-esp-elf-g++ -c @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/cpp_flags -w -Os -Werror=return-type -w -x c++ -E -CC -DF_CPU=160000000L -DARDUINO=10607 -DARDUINO_ESP32C3_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32C3_DEV" -DARDUINO_VARIANT="esp32c3" -DARDUINO_PARTITION_default -DARDUINO_HOST_OS="macosx" -DARDUINO_FQBN="esp32:esp32:esp32c3:UploadSpeed=921600,CDCOnBoot=default,CPUFreq=160,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=none,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/defines -I/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST -iprefix /Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/include/ @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/includes -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/qio_qspi/include -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/cores/esp32 -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/variants/esp32c3 @/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/build_opt.h @/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/file_opts /Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/sketch/TEST.ino.cpp -o /private/var/folders/2f/smt1fsg11lv2mlnw6zc5xym40000gn/T/3524793120/sketch_merged.cpp
/Users/h.dpalmboom/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /private/var/folders/2f/smt1fsg11lv2mlnw6zc5xym40000gn/T/3524793120/sketch_merged.cpp

ctags: Warning: Unsupported parameter 'T' for "fields" option
Compiling sketch...
/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp-rv32/2411/bin/riscv32-esp-elf-g++ -MMD -c @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/cpp_flags -w -Os -Werror=return-type -DF_CPU=160000000L -DARDUINO=10607 -DARDUINO_ESP32C3_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32C3_DEV\"" "-DARDUINO_VARIANT=\"esp32c3\"" -DARDUINO_PARTITION_default "-DARDUINO_HOST_OS=\"macosx\"" "-DARDUINO_FQBN=\"esp32:esp32:esp32c3:UploadSpeed=921600,CDCOnBoot=default,CPUFreq=160,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=none,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default\"" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/defines -I/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST -iprefix /Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/include/ @/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/flags/includes -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.4-2f7dcd86-v1/esp32c3/qio_qspi/include -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/cores/esp32 -I/Users/h.dpalmboom/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0/variants/esp32c3 @/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/build_opt.h @/Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/file_opts /Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/sketch/TEST.ino.cpp -o /Users/h.dpalmboom/Library/Caches/arduino/sketches/1C8DCEF23D8B1A4E5C31BB7A0E40C477/sketch/TEST.ino.cpp.o
/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST/TEST.ino:1:9: error: expected constructor, destructor, or type conversion before ';' token
    1 | void setup() {
      |         ^
/Volumes/ARDUINO-1/ESP32C3TESTWifi/TEST/TEST.ino:6:8: error: expected constructor, destructor, or type conversion before ';' token
    6 | void loop() {
      |        ^
exit status 1

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

Please use code tags for posting long compiler error/warning text!!!

I moved your topic to a more appropriate forum category @HansPalmboom.

The Nano Family > Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.

In the future, when creating a topic please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.

My appologies - fixed it.

Thanks.

Unfortunately, I can't help. The error messages don't make any sense to me.

Can you compile the code if you select other Arduino boards, like Uno?

An update:
I can compile & upload perfectly fine all my code to 3 different ESP32-C3's with my old Windows computer running version 2.3.6

If I use my new MacBook Air running the 'Apple Silicon' version of the Arduino IDE, I get the errors as posted above. I'm stumped. Next idea is to uninstall the IDE and start all over. I'll let you know.

I just tried your sketch on my Mac and no errors. My guess is a failed install.

The first error is to do with the ctags executable. It says T is unsupported parameter for the firlds option. What that means to me is some sort of install error OR wrong install package. The problem is ctags is at the builtin level so is not subject to wrong platform install.
If you can afford to lose ALL Arduino content, delete the entire (user)/Library/Arduino15 folder. If you need to preserve some at least make sure you delete folder packages/builtin under Arduino15.

I'm going for a clean install of the IDE. I can't even upload the frikin' blink sketch to an Uno right now.

Sanity check, your Mac is a Silicon Mac, you did download the Apple Silicon version?

Screenshot 2025-05-03 at 15.11.53
Screenshot 2025-05-03 at 15.11.33

Yes, I did. Good that you asked.

I did a clean install and with the blink sketch to an Uno I get this:

FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: /Users/h.dpalmboom/Library/Arduino15/packages/arduino/hardware/avr/1.8.6
Using core 'arduino' from platform in folder: /Users/h.dpalmboom/Library/Arduino15/packages/arduino/hardware/avr/1.8.6

Detecting libraries used...
/Users/h.dpalmboom/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/h.dpalmboom/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/Users/h.dpalmboom/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /Users/h.dpalmboom/Library/Caches/arduino/sketches/B82C949317EBA2B665E7E10C73978EF2/sketch/Blink.ino.cpp -o /dev/null
fork/exec /Users/h.dpalmboom/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++: bad CPU type in executable

Compilation error: fork/exec /Users/h.dpalmboom/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++: bad CPU type in executable

Sequoia 15.3

Did you delete the folder (user)/Library/Arduino15 AND the two hidden folders beginning .arduino


May need to KILL the Agent first. IIRC you also need the Silicon version of the Agent but VERY unsure about that part (Silicon)

I started with this:

rm -rf ~/Library/Arduino15 \
       ~/Library/Application\ Support/Arduino \
       ~/Documents/Arduino \
       ~/Library/Caches/cc.arduino \
       /Applications/Arduino.app

And now going for a clean install of the IDE for Apple Silicon.

Edit* After installing, I got this message and hit Yes:

It's compiling and uploading the Blink Sketch. Now, let's see if it will accept ESP32-C3

Crossing my fingers for you, but I would have liked to see the two hidden folders removed as well. They both have LOTS of files.

Thank you for your help. It's working now, I can upload to ESP32! To be honest, I don't know where to find those files on a Mac blush I need one for work but grew up with Dos/Win. I googled the Terminal commands to clean out Arduino from the harddrive.

After all, it was a clean install and removal of several files. I don't think I removed them all as the ESP32's under board manager where already there after the new install.

So my apologies to you, Sonofcy for not following your advise specifically but you did push me in the right direction.

Those are hidden files (starts with a period) under your user name. To reveal them use the key combo Shift-Command-. (period)
You likely don't have the .arduino-create unless yiou installed the Arduino Agent (a seperate install for cloud work)
Glad to hear it was fixed.