Source: https://mokxi.com/errors/expected-semicolon-before
Updated: 2026-11-16

Home / Errors
Arduino build error

# error: expected ';' before '}' token

The compiler reached the end of a statement and found no semicolon, so it stops at the next token.

Try the fixed sketch in Mokxi See the causes

- Build error
- 3 common causes
- Seen 2,761 times in failed builds on Mokxi in the 30 days to November 16, 2026.

The message

## What the Arduino IDE prints

Output window

The reported line is where the compiler noticed. The missing semicolon is almost always at the end of the line above it.

Mokxi's compiler, clang, words it as expected ';' after expression, and points just after the last character of the line that needs the semicolon.

Causes

## The 3 usual causes with the fix

### 1A statement has no semicolon at its end

Every statement ends with a semicolon: a call, an assignment, a variable. Look at the end of the line before the one in the message.

Broken

Fixed

Mokxi’s build tab says: A semicolon (;) is missing.

Try this fix in Mokxi

### 2A struct or class definition needs one after its closing brace

A struct ends with }; and the semicolon is part of the definition. Without it the compiler reads the next line as part of the struct.

Broken

Fixed

Mokxi’s build tab says: A semicolon (;) is missing.

Try this fix in Mokxi

### 3A variable at the top of the file has no semicolon

Global variables end with a semicolon too. The error then shows up on the line below, where the next function starts.

Broken

Fixed

Try this fix in Mokxi

FAQ

## Questions and answers

### What does "expected ';' before" mean in Arduino?

A statement is missing the semicolon that ends it. The compiler only notices when it reaches the next token, so the line in the message is the line after the mistake.

### Why does the error point at a line with a semicolon?

The line in the message is where the compiler gave up. Check the end of the line above it first.

### Does a #define or #include need a semicolon?

No. Lines that start with # are instructions to the preprocessor and never end with a semicolon.

Next

## More errors and the longer guide

- error: expected primary-expression before ')' token
- error: expected '}' at end of input

The longer guide to this error All Arduino errors
