Skip to content

Non-standard and cryptic error message when compilation fails due to no match for #include directive #37

@ubidefeo

Description

@ubidefeo

Describe the bug
ne of the most common errors encountered by beginners is caused by them trying to compile a sketch they found without installing the library dependencies (all too often the sketch author doesn't even bother to document deps).
Since we don't currently bundle the standard libraries with Arduino IDE 2.0.0 (https://arduino.atlassian.net/browse/ATL-825), this is likely to be even more common.
In the Java IDE, Arduino CLI, and Arduino Web Editor, compiling a sketch with an #include directive for a non-existent header file, for example:

#include <Nonexistent.h>
void setup() {}
void loop() {}

will produce an error message that looks like this (even without verbose compilation output enabled):

C:\program-files\arduino\cli\arduino-cli_nightly\Foo\Foo.ino:1:10: fatal error: Nonexistent.h: No such file or directory
 #include <Nonexistent.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
Error during build: exit status 1

This is all you get with the default non-verbose compilation output setting:

Compilation error: Error: 2 UNKNOWN: exit status 1

The verbose compilation output is still pretty cryptic

Alternatives for Nonexistent.h: []
ResolveLibrary(Nonexistent.h)
  -> candidates: []
Compilation error: Error: 2 UNKNOWN: exit status 1

You're not going to find many helpful results if you Google these strings, whereas there are zillions for "No such file or directory".
The Java IDE and Arduino Web Editor also highlight the line of the sketch associated with the error:

Clipboard01

while Arduino IDE 2.0.0 gives no indication of the source of the error.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: 2.0.0-beta.2-snapshot.298cc11
  • CLI Version: 0.16.0 alpha [c977a238]

[ originally reported by @per1234 ]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions