No such file or directory found when save at different location

i have read related topics but still can not sove problem
My arduino IDE is 1.8.19.
when i go to examples and compile the code it works without error but when i save file on my destop or any other location it give me error
here is the error message
Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"

5110_LCD.lnk:4:10: fatal error: fonts/Small_LCD_Fonts.h: No such file or directory

#include "fonts/Small_LCD_Fonts.h"

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

compilation terminated.

exit status 1

fonts/Small_LCD_Fonts.h: No such file or directory

What is the full path to the Small_LCD_Fonts.h file ?

You get that error on saving? That is very odd because the error message ends with saying

Which strongly suggests you are not saving but compiling.

Are you sure you get this when saving?

just by compiling example there is no error, when i do some changes in code it need to save the file some location, after i save the file and then compile at that time i get error


here you can see image code is 100% same one i directly run from Example and other i just save at different location. and after that during compiling i get error

Thank you for making that clear. It is not the impression given by your first post.
Can you post the code that generates this error please.

5110_LCD.lnk.ino (2.2 KB)
i attach the arduino file is that ok for code now

See all those squares in the code. That is the forum software making a mess of it. This is why we ask all users to post code using code tags. You should have got a warning about this but chose to ignore it and "post anyway".

You may want to read this before you proceed:-
how to get the best out of this forum
Please edit that post to include the code tags.

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use [color = red]code tags[/color] (the </> icon above the compose window) to make it easier to read and copy for examination

The "Save As" capability of Arduino IDE 1.8.19 does not support subfolders of sketches. It will only save the files from the root of the sketch folder:

So the original example sketch looks like this:

Nokia_LCD_Font/
├── LICENSE
├── Nokia_LCD_Font.ino
└── fonts/
    ├── Bold_LCD_Fonts.h
    ├── Glyphs_LCD_Fonts.h
    └── Small_LCD_Fonts.h

but then after you save it somewhere else, all you are left with is this:

5110_LCD.lnk/
└── 5110_LCD.lnk.ino

You can fix the error by using the Windows File Explorer to manually copy this folder:

<sketchbook folder>\libraries\Nokia_5110_LCD_library\examples\Nokia_LCD_Font\fonts

To the 5110_LCD.lnk folder.

(you can find the location of <sketchbook folder> in the Arduino IDE at File > Preferences > Sketchbook location)


i did as you said but still error

You are very close, but you did not follow my instructions correctly. You copied the files from <sketchbook folder>\libraries\Nokia_5110_LCD_library\examples\Nokia_LCD_Font\fonts. You were supposed to copy the folder.

Your sketch structure currently looks like this:

5110_LCD.lnk/
├── 5110_LCD.lnk.ino
├── Bold_LCD_Fonts.h
├── Glyphs_LCD_Fonts.h
└── Small_LCD_Fonts.h

but the #include directives in the sketch are written for this structure:

5110_LCD.lnk/
├── 5110_LCD.lnk.ino
└── fonts/
    ├── Bold_LCD_Fonts.h
    ├── Glyphs_LCD_Fonts.h
    └── Small_LCD_Fonts.h

The obvious solution is to create a fonts subfolder in the sketch and move those .h files into it.

However, I will suggest an alternative approach:

Leave the files as they are now in your sketch and modify the #include directives for that structure. For example, you would change this line:

#include "fonts/Small_LCD_Fonts.h"

to this:

#include "Small_LCD_Fonts.h"

The benefit to having the files in the root of the sketch folder is it will make it compatible with the buggy "Save As" behavior of Arduino IDE 1.x.

Hi man thank you so much, it was my first post on forum, your response is so good, like profesionals, thanks again.
my problem is solved here is the image.

You are welcome. I'm glad it is working now. Enjoy!