Compilation error of No such file or directory

my .ino file and .h file are in the same file, but as i run the .ino document, it constantly told me "Compilation error: Project.h: No such file or directory". i don't know if it's because of my slection of UNO boards or some other reasons:(

It could be due to errors in the sketch that you didn't show us. Or other reasons.

You must delete the statement in row 31 and swap lines 44 and 45. For any reason.

Welcome to the forum

If you mean that they are in the same folder then what does your #include statement look like

Is it

#include <Project.h>

or

#include "Project.h"

There is a difference and the second one would be correct as long as you have used the correct filename for the .h file

Please post your full sketch, using code tags when you do

"Case" is important....

Project.h

... is different from...

project.h

Be sure the filename is correct.

hii here are the screenshots. my coding is like 150 rows, and im not sure if i can just paste such many rows here.
the file that shows in error message is in subfolder (under addLibrary), idk if i need to drag them out to the same primary folder (as there are so much files...:frowning: )


Hi @haouser.

That is the problem. Try this:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Take note of the path shown in the "Sketchbook location" field of the dialog.
  3. Click the "CANCEL" button.
    The "Preferences" dialog will close.
  4. Start macOS "Finder").
  5. Navigate in finder to the folder at the following path on your hard drive:
    /Users/mao/Downloads/Smart_Car_Project/addLibrary
    
  6. Copy the folders from the addLibrary folder to the libraries subfolder of the path you saw in the "Sketchbook location" preference.
    The folder structure of the installation must look like this:
    <Sketchbook location>/
    β”œβ”€β”€ libraries/
    β”‚   β”œβ”€β”€ FastLED/
    β”‚   β”‚   β”œβ”€β”€ FastLED.h
    β”‚   β”‚   ...
    β”‚   ...
    ...
    
    (where <Sketchbook location> is the path from the Sketchbook location" preference)
  7. Select File > Quit (or Arduino IDE > Quit Arduino IDE for macOS users) from the Arduino IDE menus.
    All Arduino IDE windows will close.
  8. Start Arduino IDE.

Now try compiling the sketch again. Hopefully this time everything will work as expected. Let us know if you still encounter some problems and we'll try to provide further assistance.

i don't know if there are missing files for "Sketchbook location " while downloading... as i opened the Arduino folder from sketch, there is no folder, even the libraries. i create a new one but it still didn't work

This is expected if you have never installed any libraries before. I should have mentioned that you might need to create the libraries folder in my instructions. I apologize for any confusion caused by my omission.

Please provide more details. By "didn't work", do you mean that you still encounter the exact same error when compiling the sketch?:

In file included from /Users/mao/Downloads/Smart_Car_Project/DeviceDriverSet_xxx0.h:15:0,
                 from /Users/mao/Downloads/Smart_Car_Project/Project.h:10,
                 from /Users/mao/Downloads/Smart_Car_Project/Smart_Car_Project.ino:1:
/Users/mao/Downloads/Smart_Car_Project/FastLED.h:38:10: fatal error: cpp_compat.h: No such file or directory
 #include "cpp_compat.h"
          ^~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: cpp_compat.h: No such file or directory

Or are you now encountering a different problem?

I just found i named the folder with libraries, instead of Libraries. I'm so sorry for that.
Now it didn't show me any errors. i think it looks good now, and i will connet my robot car tomorrow for testing:)

and thanks yall so much for help!!! :blush: :blush:

Great news! I'm glad it is compiling now.

Regards, Per

The name of the folder should be libraries (lowercase l)

i just tried both lowercase and uppercase and there was no error message. I guess the key problem is i didn't have that folder, no matter started with which lettercase lol

macOS has a case-insensitive filesystem, so you can sometimes get away with using the incorrect case in folder names.