3

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

2
  • In the error message, it shows <> for the problem file, although your question suggests you're using "" (as you should). Which is it?
    – Mark Smith
    Mar 17 '17 at 22:45
  • Seems I have copied the wrong error message. Thanks for noticing. Mar 18 '17 at 12:00
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.

1

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.

2
  • Yes, that is what I have done but the file I have included as ".." can't be located by the IDE even though it is in the same folder as the main .ino file. Mar 18 '17 at 11:55
  • 1
    The 'brackets' aren't to do with where the files are, but to do with the order the directories are searched. For GCC (Visual Studio is different) files in quotes are searched in the directory containing the file that is doing the including then the "preconfigured system directories" where as the <> brackets skip the local folders. Also it is easier to find compile errors if you include <> first and the "", because the error location of a duplicate definition will be reported against you code and not the system libraries (which you shouldn't be changing) May 17 '17 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.