Arduino build error

error: 'led' redeclared as different kind of symbol

A name can mean one thing at a time. The sketch uses it for a variable and for a function, or for a variable and a name the Arduino core already uses.

  • Build error
  • 2 common causes
  • Seen 354 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:3:6: error: 'led' redeclared as different kind of symbol
sketch.ino:1:5: note: previous declaration 'int led'
exit status 1

Rename one of them.

Mokxi's compiler, clang, words it as redefinition of 'led' as different kind of symbol.

Causes

The 2 usual causes with the fix

1A variable and a function share a name

Give the function a verb and the variable a noun, such as ledPin and blinkLed.

Broken
int led = 13;

void led() {
  Serial.println("blink");
}

void setup() {
  Serial.begin(9600);
  led();
}

void loop() {
}
Fixed
int ledPin = 13;

void blinkLed() {
  Serial.println("blink");
}

void setup() {
  Serial.begin(9600);
  blinkLed();
}

void loop() {
}

Mokxi’s build tab says: led is already the name of something in the board's core or a library

Try this fix in Mokxi

2A variable is named like an Arduino function

millis, delay, random and others are already functions. A variable with the same name clashes with them. Pick another name.

Broken
unsigned long millis = 0;

void setup() {
  Serial.begin(9600);
  Serial.println(millis);
}

void loop() {
}
Fixed
unsigned long lastTime = 0;

void setup() {
  Serial.begin(9600);
  Serial.println(lastTime);
}

void loop() {
}

Mokxi’s build tab says: millis is already the name of something in the board's core or a library

Try this fix in Mokxi

FAQ

Questions and answers

What is a symbol?

A name in the program: a variable, a function or a type. A symbol is one kind of thing at a time.

How do I know which names are taken?

The Arduino language reference lists them. Names with a capital in the middle, such as digitalWrite, are the core.

Does it matter that one is a global and one is local?

A local variable hides the global of the same name. Two globals or a global and a function clash.