Arduino ( C++ ) not including library in specific project

471 Views Asked by At

When I add Arduino's own library to two projects, one of them successfully compiling, one of them not. What the reason is? I can't figure out.

Keypad.h:6:27: fatal error: OnewireKeypad.h: No such file or directory
 #include <OnewireKeypad.h>
                           ^
compilation terminated.
Error compiling.

Compiled with error: No such file or directory

Compiled succesfful

1

There are 1 best solutions below

2
On

Most likely:

You need to include any library you use in your sketch (even if it is used in another file also). This is so the IDE can copy it to the temp directory. So you'll need #include <OnewireKeypad.h> in your Keypad.h and sketch file.

Something else to try:

Keypad is the name of a library (uses Keypad.h). If you have it installed, you may be grabbing this instead of your local sketch file.

Try renaming the file to something else like OWKeypad.h. Or you could try including it with quotes instead of angle brackets: include "file.h" instead of #include <file.h>.