Skip to content

#include "file.xyz" fails to find "file.xyz" in sketch directory, for unusual file extensions #2227

@jrobert-gh

Description

@jrobert-gh

Describe the problem

In IDE 2.1.0, #include with a filename in quotes (not angle brackets) and the file exists in the sketch directory but has an unusual extension such as xyz, the compilation fails. The error message given is:

Detecting libraries used...
/Users/jrobert/Projects/ArduinoWksp/sketch_jun25a/sketch_jun25a.ino:3:12: fatal error: Test.xyz: No such file or directory

This example fails:

#include "file.xyz"
void setup() {}
void loop() {}

To reproduce

Demo 1:

  • Create a new sketch with the above code.
  • Create local include file named "file.xyz"
  • Compile the sketch.
  • Note the error message, as stated above.

Demo 2:

  • In the .ino file, replace the include file's name with its full path.
  • Repeat the compilation. Note that the compilation now succeeds.

Demo 3:

  • Rename the include file from "file.xyz" to "file.h"
  • In the .ino file's #include statement, make the same substitution ("file.xyz" -> "file.h").
  • Repeat the compilation. Note the the compilation succeeds again.

Expected behavior

All three demos should have compiled without error.

Arduino IDE version

Arduino IDE 2.1.0

Operating system

macOS

Operating system version

12.6.7

Additional context

IDE 1.8.19 passes the above tests correctly.


If, instead of just the filename, its full path is given, the error is avoided.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions