Comment before include breaks build - Particle Dev [Solved]

I have a motorClass.ino file that includes a motorClass.h file and it does not have the main setup and loop functions. In total, I have 2 .h files and 2 .ino files.

Everything works great till I add a comment on top of the motorClass.ino.

First 2 lines of code which DOESN’T compile

// Motor Class Source File
#include "motorClass.h"

First 2 lines of code which DOES compile

#include "motorClass.h"

I’m clueless about what’s going on and would love some help with this seemingly bizarre issue!

It’s an old known issue of the wiring preprocessor.
Try adding a blank line before the comment.

Still no luck.

This is what I tried. I used “-empty line-” to indicate the empty line here.

-empty line-
// Motor Class Source File
#include "motorClass.h"

Have you tried changing the comment character? As I recall that was another thing that could mess up the preprocessor:

-empty line-
/* Motor Class Source File */
#include "motorClass.h"

That didn’t do it as well.

Hmm… 2 ino files? I would try to make sure to only include one, make the other one .cpp or .c, whatever seems appropriate.

Also consider sharing your source code so we can try compiling it as well to speed up this shot-gunning that’s happening here :smile:

2 Likes

Duh’, missed the bit about the second .ino :blush:

Thanks for the help. Renaming the file to a .cpp solved the issue. Had some trouble with a .c extensions though, but I’m happy for now.

1 Like