Skip to Content

Arduino IDE compile error: 6 checks before the code

Short answer: when Verify fails in the Arduino IDE, read the first error, check the include and the library folder, the selected board, the board package and the versions, in this order, before you change the code.

Download the checklist (PDF, 2 pages)

Descarga la lista de comprobación (PDF, 2 páginas)

These checks apply to Arduino IDE 1.x and 2.x and to arduino-cli, with any board. They cover compiling only: if the sketch compiles but does not reach the board, start with the lesson on upload failures.

Six checks, in this order

CheckWhat to doGood result
1. First errorScroll up the console to the first line with "error:" and fix that one first. The errors below it often come from it. To see more detail, turn on "Show verbose output during" compile in Preferences.After compiling again, the other errors go away or change.
2. Include"No such file or directory" usually means that the library is not installed. Install it with the Library Manager (Tools > Manage Libraries) or with Sketch > Include Library > Add .ZIP Library. Check also the spelling of the include: on Linux, upper and lower case count.The compiler finds the header.
3. FolderKeep one copy of each library, in the libraries folder of your sketchbook. If the log says "Multiple libraries were found", read the Used: line, which is the copy that was compiled. That message alone does not stop the compile.Used: points to the copy you want.
4. BoardSelect the board in Tools > Board. The board sets the architecture, and a library written for another architecture can fail. The log warns with "claims to run on ... architecture(s)".No architecture warning, or a library that supports your board.
5. Board packageEach board needs its core, installed from the Boards Manager (Tools > Board > Boards Manager). Third-party boards are listed only after you add their URL in Preferences, "Additional boards manager URLs", one URL per line.The board appears in Tools > Board.
6. VersionsCore and library have to work together. If it stopped compiling after an update, install the previous version from the Library Manager or the Boards Manager. From IDE 1.x to 2.x: IDE 2 may not take your old settings, so check the sketchbook location and the additional URLs.The same sketch compiles again.

What the console tells you

  • "fatal error: X.h: No such file or directory": library not installed or include misspelled.
  • "Multiple libraries were found for": two copies of the library; check the Used: line.
  • "WARNING: library ... claims to run on ... architecture(s)": the selected board has another architecture.
  • "Platform ... not found: platform not installed": the board package is not installed.
  • Errors inside library files after an update: core and library versions that do not work together.
  • Compiled in IDE 1.x, IDE 2 finds nothing: sketchbook location or additional URLs not carried over.

Industrial Shields PLCs

Arduino based PLCs (M-Duino, Ardbox) and ESP32 PLCs compile with the Industrial Shields boards. Add http://apps.industrialshields.com/main/arduino/boards/package_industrialshields_index.json in "Additional boards manager URLs", then search "industrialshields" in the Boards Manager and install the package for your PLC: "industrialshields", "industrialshields-esp32" or "industrialshields-megaavr". Then select the family and the model in the Tools menu. Raspberry PLC is not programmed with the Arduino IDE.

Next steps

Sources

Arduino Help Center: If your sketch doesn't compile, Add libraries to Arduino IDE, Error: Multiple libraries were found, Find sketches, libraries, cores and other files, Add or remove third-party boards in Boards Manager. docs.arduino.cc: Arduino IDE 2 Board Manager and library tutorials, Arduino Library specification, arduino-cli sketch build process and configuration. Message texts from the arduino-cli source.

¿Error de compilación en Arduino IDE antes de subir? Seis comprobaciones: primer error, include, carpeta, placa, paquete del Boards Manager y versiones.

Commenting is not enabled on this course.