Source: https://mokxi.com/errors/void-value-not-ignored
Updated: 2026-11-16

Home / Errors
Arduino build error

# error: void value not ignored as it ought to be

A function declared void gives nothing back. The code tried to store or test what it returned.

Try the fixed sketch in Mokxi See the causes

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

The message

## What the Arduino IDE prints

Output window

Either change the function to return a value, or stop using its result.

Mokxi's compiler, clang, words it as initializing int with an expression of incompatible type void.

Causes

## The 2 usual causes with the fix

### 1The result of a void function is stored

Declare the function with the type it returns, and add a return line.

Broken

Fixed

Try this fix in Mokxi

### 2A void call is used as a condition

Serial.begin() returns nothing, so it cannot be tested. Check the thing you actually care about, such as the port being ready.

Broken

Fixed

Try this fix in Mokxi

FAQ

## Questions and answers

### What does void mean?

It means returns nothing. A void function does its work and gives no value back.

### How do I return a value?

Put the type before the name, such as int work(), and end the function with return value;.

### Which Arduino calls return nothing?

Many do: pinMode, digitalWrite, delay and Serial.begin. Their effect is the point, not a value.

Next

## More errors and the longer guide

- error: no matching function for call to 'digitalWrite(int)'
- error: lvalue required as left operand of assignment

Every Arduino compile error All Arduino errors
