Arduino build error

error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

A const char* points at text that must not change. A char* promises that the code may change it. C++ will not let you drop the promise.

  • 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
sketch.ino: In function 'void setup()':
sketch.ino:6:15: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
    6 |   char* copy = word;
exit status 1

Make the receiving side const, or copy the text into a buffer you own.

Mokxi's compiler, clang, words it as cannot initialize a variable of type char * with a value of type const char *.

Causes

The 2 usual causes with the fix

1A const pointer is stored in a plain one

Declare the new pointer const as well, if you only read the text.

Broken
void setup() {
  Serial.begin(9600);
  const char* word = "hello";
  char* copy = word;
  Serial.println(copy);
}

void loop() {
}
Fixed
void setup() {
  Serial.begin(9600);
  const char* word = "hello";
  const char* copy = word;
  Serial.println(copy);
}

void loop() {
}

Try this fix in Mokxi

2A const pointer is passed to a function that may change it

If the function only reads the text, make its parameter const char*. If it changes the text, give it a buffer of your own.

Broken
void shout(char* text) {
  Serial.println(text);
}

void setup() {
  Serial.begin(9600);
  const char* word = "hey";
  shout(word);
}

void loop() {
}
Fixed
void shout(const char* text) {
  Serial.println(text);
}

void setup() {
  Serial.begin(9600);
  const char* word = "hey";
  shout(word);
}

void loop() {
}

Mokxi’s build tab says: shout is called with values it does not take.

Try this fix in Mokxi

FAQ

Questions and answers

What does const char* mean?

A pointer to characters that the code promises not to change. String literals such as "hello" have this type.

Can I just cast the const away?

You can, but changing text that lives in read-only memory crashes or does nothing. Copy it into a char array first.

Why is this an error in Arduino and a warning elsewhere?

The Arduino compiler runs with strict C++ rules for pointer conversions. The -fpermissive flag in the message is the switch that would relax it, and the fix is to make the types match.