4

For some reason, the Arduino IDE can't find the file I have made for the project:

#include <foo1.h>
#include <foo2.h>
#include "foo3.h"

Where foo1 and foo2 are normal libraries thus included with <..> but foo3 is another file I wrote which resides in the same directory as the .ino file from where this code is taken. If I essentially convert foo3 into a library and include it as a library in my project it works but makes the project harder to move.

Error I get:

Project.ino:6:23: fatal error: foo3.h: No such file or directory
:#include "foo3.h"
:compilation terminated
Error compiling project sources

Note: Error is persistent in both the Arduino IDE and VMicro

3 Answers3

2

The question is a bit unclear, however as far as I know, for the included libraries use:

#include <SPI.h> 

So the < and > are used for common libraries which are in the C:\Program files...\Arduino folder

And for specific (own made or sketch-depending) include files

#include "MyFile.h"

should be used, which should be located in the same folder as the sketch file.

sa_leinad
  • 3,218
  • 2
  • 23
  • 51
Michel Keijzers
  • 13,014
  • 7
  • 41
  • 58
2

It seems that my mistake was that I just created new files with another program and simply put them in the project directory. This probably confused the IDE as the files were not included in the build of the project.

Managed to fix this issue by creating new files within the project itself and simply copying my code into them. For VMicro/Visual Studio:

VMicro\Add Code\Add Empty Arduino .h and .cpp files

2

Changing to double quotes with header files in the same folder worked for me.