Original post topic: Error message saying a .h file and a directory doesn't exist, but they do (?)
Hi, so I can't make sense of the error message. The short version says:
C:\Users\Tuino\Documents\Arduino\libraries\SSD1306Ascii/SSD1306Ascii.h:28:28: fatal error: fonts/allFonts.h: No such file or directory
#include "fonts/allFonts.h"
In the tutorial book I'm using I'm not told to include a library with that name so I ignored that idea.
After google searches and looking around the forum I've made sure to place the files in the right directories and checked that all the right libraries are included in my sketch. I have found a file called allFonts.h and placed it with the other .h files in my sketchbook folder. But i get the same error.
Does "fonts/allFonts.h" point to a .h file with that name or does the "fonts/" part of it suggest that it's a directory - a folder named fonts with a file called allFonts.h in it? In that case it shouldn't be a problem since there I have a file called allFonts.h in the folder called fonts, that file is also placed in the sketchbook folder.
The end goal in the tutorial is to have a clock thermometer that is connected to the internet via WiFi, it will tell time and temperature using a neo pixel ring and a servo with a pointer.
Below you can se the short error message, my sketch and a full error message is attached.
Help is much appreciated!
Error message
Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"
In file included from C:\Users\Sculptuino\Documents\Arduino\libraries\SSD1306Ascii/SSD1306AsciiWire.h:27:0,
from C:\Users\Sculptuino\Documents\Arduino\Int.klocktermometer\Int.klocktermometer.ino:6:
C:\Users\Sculptuino\Documents\Arduino\libraries\SSD1306Ascii/SSD1306Ascii.h:28:28: fatal error: fonts/allFonts.h: No such file or directory
#include "fonts/allFonts.h"
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.
Post a link to where you got the SSD1306Ascii library from. Please use the chain links icon on the toolbar to make it clickable. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.
Sculptuino:
Does "fonts/allFonts.h" point to a .h file with that name or does the "fonts/" part of it suggest that it's a directory - a folder named fonts with a file called allFonts.h in it?
The latter.
Sculptuino:
In that case it shouldn't be a problem since there I have a file called allFonts.h in the folder called fonts, that file is also placed in the sketchbook folder.
It's not clear what you mean by this. That include is in the SSD1306Ascii library so the path is relative to that library. So the expected folder structure is:
Here is a link to the site i got the library from:
What i meant in the second quote in your post was that if my understanding was correct in that the error message said that a file called allFonts.h is missing in a folder called fonts it strikes me as strange since there is a file called allFonts.h in the folder called fonts. Maybe I've got it all wrong.
After looking at the expected file structure you showed I'm having a bit of trouble understanding where the allFonts.h should be placed. Is SSD1306Ascii.h a folder or a .h file?
The structure of that library is different from how you have it installed. I think this is the root cause of your problem. Unfortunately the structure of that repository does not permit the easy "Add .ZIP Library" installation technique so you need to do a manual installation:
Did as you said and now it works! I think the mistake i did before was that i opened the .zip file and took the first map i came across which is the one called SSD1306Ascii-master. I renamed it to SSD1306Ascii and placed it in the sketchbook folder, leading to that weird folder structure.
Getting the correct folder structure in mind i noticed that there is a folder called SSD1306Ascii within the first folder SSD1306Ascii-master. So I placed SSD1306Ascii in the sketchbook folder and the code compiled.
A newbie mistake i guess but I learned something. Thanks alot!!
Yeah, it's a tricky thing. The library folder must always be directly under the libraries folder, not in a subfolder. Most Arduino libraries are already structured that way and this also allows you to use the "Add .ZIP Library" installation method. Unfortunately others (such as SSD1306Ascii) put the library in a subfolder of the repository, which requires manual installation.
Making it more confusing is that there are two different library formats. With a library in the 1.0 format you find a .h file in the root of the library. With the 1.5 format the source files will be located in the src subfolder of the repository but there will always be a library.properties file in the root of the library. The SSD1306Ascii library is in 1.5 format.
Thats good to know! I assumed the libraries always were structured so that the folders would be placed in the correct way, will be more attentive to that from now on.
Ok, so thats what that is! I've noticed that the .h file can be found in different places now and then which was confusing. Now the ASD1306Ascii library makes a lot more sense, thanks for the info!