Solved: #include header file not work

Tried different ways.
#include "filename.h" do not work at all.
Put filename.h and filename.cpp in different directories.

  1. put the same directory as the ino file.
  2. put the sub-directory (/filename/) to the ino file
  3. put in the directory (filename/) parallel to the directory of ino file.
    always report not found the filename.h file.
    Arduino IDE version is 1.8.13
    Can latest Arduino IDE only use library files?

If you have your .h and .cpp file in the same directory as your .ino file, #include "filename.h" should work.

How do you know it is not working? Please post your code and the errors generated following this: How to get the best out of this forum - Using Arduino / Installation & Troubleshooting - Arduino Forum

I woud comment out the line filename.h inside the .cpp file

then copy .cpp contents into a .h file, just before the last #endif ( If you have it in your .h )

that would do a trick

Thanks, I have to make a zip file and upload a library.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.