4
\$\begingroup\$

Hello in my arduino code i simple want to include another file like this:

#include "letters.h"

but it says

 error: letters.h: No such file or directory

the letters.h is definitely there, right next to the ino file from which i compile.

\$\endgroup\$
5
\$\begingroup\$

You don't need to include, just call functions from another file. It handles for you.

\$\endgroup\$
  • 1
    \$\begingroup\$ yep, but only if the other files also ends with .ino \$\endgroup\$ – clamp Feb 26 '12 at 12:34
  • \$\begingroup\$ Arduino says that the programming language of platform is "Arduino Programming Language", not C or C++ (they gotta be kidding =) ). But it parses your .pde (or .ino) files to a .cpp file under temp folder of your OS. .h files may not be added. One possible way can be moving your header files to "ardunio include directory" and using angle brackets instead. But changing the file extension might be easier. \$\endgroup\$ – Onur Feb 26 '12 at 12:59
5
\$\begingroup\$

This link talks about how to do it:

http://arduino.cc/en/Guide/Libraries

For me, it was as simple as finding this menu in the editor:

Sketch -> Import Library -> Add Library
\$\endgroup\$
0
\$\begingroup\$

Try #include <letters.h> with < and > instead of double quotes.

The C++ standard says #include "header" searches the header in the same folder as the .cpp and then in the include paths, while #include <header> only searches the include paths. But the Arduino "language" is not 100% C standards compliant.

If it still doesn't work, it would mean you don't have letters.h in your libraries folder. Either add it there or copy it to your sketch folder (together with all other source files in that library), restart (all instances of) the Arduino IDE and #include "letters.h" (with the double quotes) so it is included from your sketch folder.

\$\endgroup\$

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.