Skip to content

CIRCUITERA FIELD GUIDE

Arduino Identifier Was Not Declared

Trace an undeclared Arduino identifier to its declaration, scope, spelling, header or board-specific pin alias before applying a code change.

What you see

The compiler parser fixture contains “'ledPin' was not declared in this scope”. It demonstrates the real GCC diagnostic shape handled by Circuitera.

Likely causes

  • A variable/function name has different spelling or capitalization.
  • The declaration is inside a narrower scope or appears in an unavailable header.
  • A board-specific pin alias or API is not defined for the selected profile.

Diagnostic steps

  1. Jump to the first error

    Click the diagnostic to inspect the exact source line. Compare the name to its declaration rather than replacing every occurrence blindly.

  2. Check declaration and scope

    Declare shared constants before setup()/loop() when both need them. A variable local to setup() is not automatically visible in loop(). Keep source and header declarations consistent in multi-file projects.

  3. Confirm board-aware names

    Select the intended board before relying on autocomplete or pin aliases. A6/A7, Serial1 and native USB APIs differ across AVR variants.

  4. Review a proposed fix and Verify

    Circuitera may offer a targeted suggestion. Read the change, then Verify again. Fixing the first error can remove later cascading diagnostics.

Board-specific notes

Use LED_BUILTIN for a simple onboard Blink test. Extra Mega UART names and Leonardo/Micro USB Serial behavior are not interchangeable with Uno’s single UART.

Safe recovery

Undo a broad accidental replacement and reduce the sketch to a known declaration/use pair. Keep a backup of the original project.

Evidence and references

Reviewed 2026-10-23 against Circuitera’s actual behavior. An editorial review is separate from a physical board test.

Circuitera implementation evidence

test/compiler-diagnostics.test.js; src/compilerDiagnostics.js; src/quickFixes.js

    Testing and capability boundaries →

    Keep exploring.