expected ';' before …

  • Arduino C++
  • ESP32
  • ESP8266

You may see

error: expected ';' before 'digitalWrite'
exit status 1
Compilation error: expected ';' before 'digitalWrite'

Why it happens

  • The line above the one named in the message has no ; at the end.

How to fix it

  1. Click the red message: the cursor jumps near the problem.
  2. Look at the end of the line just above it.
  3. Add the missing ;.
  4. Press Verify again. Fix only the first red line each time: the others often disappear with it.

It worked if: Verify finishes with "Sketch uses … bytes".

Seen in a real run (some lines are close variants of it). Produced with Arduino CLI 1.5.1 and Arduino AVR core 1.8.8 (the same compiler the Arduino IDE uses).

Didn't help? Search another error or ask us.