Source: https://mokxi.com/errors/invalid-operands-of-types
Updated: 2026-11-16

Home / Errors
Arduino build error

# error: invalid operands of types 'const char [6]' and 'const char [6]' to binary 'operator+'

An operator such as + or % was used on types it does not support. Two quoted texts cannot be added. A decimal number has no remainder.

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

Convert one side to a type the operator accepts, such as a String.

Mokxi's compiler, clang, words it as invalid operands to binary expression.

Causes

## The 2 usual causes with the fix

### 1Two quoted texts are added with +

Quoted text is not a String, so + does not join it. Make one side a String.

Broken

Fixed

Mokxi’s build tab says: Text in quotes cannot be joined with +

Try this fix in Mokxi

### 2% is used on a float

The remainder operator needs whole numbers. Use fmod() for a float, or convert to int.

Broken

Fixed

Mokxi’s build tab says: float and int cannot be combined with this operator.

Try this fix in Mokxi

FAQ

## Questions and answers

### How do I join text in Arduino?

Use a String, such as String("a") + "b", or print the parts one after the other with Serial.print.

### Why does "Temp: " + 25 compile but print nonsense?

It adds 25 to the address of the text, so it prints the text from the 26th character on. Use String("Temp: ") + 25.

### What does fmod do?

It returns the remainder of a division for float values, as % does for whole numbers.

Next

## More errors and the longer guide

- error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
- error: cannot convert 'String' to 'const char*'

Every Arduino compile error All Arduino errors
