Properties source file named as "library" causes error

Hi,

I noticed an error I get when the Properties source file is named as "library".

When I change it to anything else the error goes away.

What is the reason for that ?

Here I named it as "library1" to solve the problem.

Hi @wolfrose. library.properties is the filename of the Arduino library metadata file:

https://arduino.github.io/arduino-cli/latest/library-specification/#library-metadata

The data in this file affects how the library is compiled by Arduino development software.

When a file named library.properties is present in the root of the library folder, the library is considered to have a "recursive" layout, which will cause the contents of the src subfolder to be compiled recursively.

When a file named library.properties is not present in the root of the library folder, the library is considered to have a "flat" layout, which will cause the contents of the src subfolder to not be compiled.

When you change the name of the library.properties file to something else, The Arduino development software will no longer recognize it as a library metadata file, so by renaming the file you are changing the library layout from "recursive" to "flat".

My guess is that the cause of the error is something in the src subfolder of the library. I notice that the library has a strange file structure where there are source code files in the root of the library, and in the src subfolder. This means that different files are compiled depending on the layout of the library.

If you want more help, you need to provide the errors you are getting when the file is named library.properties.

1 Like

Please post the contents of your library.properties file and the full error message that you get. Did you create or edit the file ?

As an aside, I believe that working with hidden file extensions is a nuisance at best

1 Like

First of all thank you so much for the information.

Secondly, even if the "src" is empty, the error still occurs.

This is the error:

Arduino: 1.8.19 (Windows 10), Board: "ESP32S3 Dev Module, Disabled, OPI PSRAM, QIO 80MHz, 4MB (32Mb), Core 1, Core 1, Hardware CDC and JTAG, Enabled, Disabled, Disabled, UART0 / Hardware CDC, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi), 921600, Debug, Enabled"

GFX_Library_TFT_eSPI_forum:1:10: fatal error: Arduino_GFX_TFT_eSPI.h: No such file or directory

 #include "Arduino_GFX_TFT_eSPI.h"

          ^~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.

exit status 1

Arduino_GFX_TFT_eSPI.h: No such file or directory

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I will attach all the files: library and arduino code.

There are libraries that are on this type of arrangement. Like this one:

GFX_Library_TFT_eSPI_forum.zip (1.1 KB)
Arduino_GFX_TFT_eSPI.zip (4.9 MB)

I don't know how to create it, and I even didn't know it's important untill posting this thread.

I copied it from another library, I thought it's just an easy to edit file and that's it.

That is expected. When a src subfolder is present, the Arduino sketch build system looks for the header file in the src subfolder.

So you can choose either one of the following two options to solve the problem:

  • Move the source code files to the src subfolder (recursive layout).
  • Leave the source code files in the root of the repository and delete the src subfolder (flat layout).

Note that library doesn't have a src subfolder, so it has a "flat" layout, meaning the sketch build system looks for the header in the root of the library repository.

1 Like

What were you hoping to edit in it and have you looked to see what it contains ?

1 Like

If the library has a "flat" layout, it is optional. This is referred to as the "1.0 format", because the library.properties file was introduced in Arduino IDE 1.5.0 and so the libraries that were written during the Arduino IDE 1.0.x era did not have the metadata file.

However, it is required if you want to use the "recursive" layout. It is also required if you want to submit the library for inclusion in the Arduino IDE Library Manager, even if the library has a "flat" layout. For this reason, you will find that most modern Arduino libraries do have a metadata file.

The file also provides some useful features, such as allowing you to specify which microcontroller architectures the library is compatible with.

1 Like

I thought they don't affect the compilatin process and they are just for formal library specification listing, just to list the main specs of a library.

But it turned out it has a specific job with the Arduino IDE. Is it used with other IDEs ?

I went back and checked how the libraries are set, wow thank you for teaching me this stuff. And I know there are much more things to learn about Arduino platform.

For example this library:

There's a "src", but as you mentioned the source files will be ".c/.cpp" files. Header files aren't considered as source files.

That's why with having "src" folder, the only files present the root directory are header files. I hope I got this one right :slight_smile:

Perhaps developers don't classify header files as "source files", but you are not correct. The header files you would use in the #include directives in your sketch program are indeed under the library's src folder, and must be located there:

The header files you see in the library root folder are used for a hacky user configuration system, as described here:

https://github.com/esp-arduino-libs/ESP32_Display_Panel#configuration-instructions

and implemented here:

Those header files are only referenced internally by the library, and either moved by the user to a separate library or else referenced by a path relative to the library.

1 Like

Thanks a lot man ! Yep that turned out to be a very important file for the Arduino system.

Absolutely there's a lot for me to learn.

You are welcome. I'm glad if I was able to be of assistance.

Regards, Per

1 Like