Local plugin/module/component [solved]

I started writing a plugin by forking an existing plugin. Sadly, I think I’ve come to the conclusion that it’s only usable by me, so I’d like to bring the plugin’s source files into my sketch’s repo. I thought it would be straightforward… rename files and paths… but I’m having more trouble than expected.

My .ino, .h, and .cpp files are all in the same directory, and the sketch includes the local file with #include "filename.h", but still no dice. “fatal error: filename.h: no such file or directory” is the error I get on compilation.

Can someone tell me what the obvious, dumb thing is that I’m getting wrong?

After trawling through Arduino forums, I finally found the answer. There’s an assumed directory structure in the latest versions of the Arduino IDE.

└ MySketch/
  ├ MySketch.ino
  └ src/
    └ MyLibrary/
      ├ MyLibrary.h
      └ MyLibrary.cpp

Note that MyLibrary.cpp must include the header file with quotes, not angle brackets. #include "MyLibrary.h" and not #include <MyLibrary.h>. Your sketch file must include the relative path as well: #include "src/MyLibrary/MyLibrary.h".

I hope this is useful to others!