I am nearly positive this used to compile (like a few weeks ago). This is the repository (careful it has an error in it) and I am trying to fix the mistake, retest and update the code library. However now my test won’t compile… It seems like the compiler thinks I am redeclaring a bunch of stuff. Maybe I am… I am new to c++ so thanks to any help.
Instructions are you have to change si_a2d_float_test.h -> si_a2d_float_test.ino and then compile.
Not sure, if this will solve anything, but when you do your
#ifndef check to avoid double include, the
#endif should wrap the whole contents of the header file and not only the
#define and the
e.g. you do this
but actually you can unconditionally do the
application.h does this
// all the contents of the complete file
And for that reason the header itself prevents repeated inclusion and each of your header files should do the same.
Another thing (which is not necessary - see solution below) you can try with your
.INO file is to add these two lines at the top
just in case the proprocesser contributes to your problem
And another tip is to look at the next few messages in your error output, since this usually also tells you with the “redeclare” error the position of the first declaration as a note
Solution of your compile error:
I’ve just built your code and the only thing I did was that I replaced this
But you should still apply the suggested form of the
#ifndef check to ensure against double includes.
Thanks @ScruffR I appreciate the advice. Here’s what I still don’t get…
This works (commented out top 2 lines)
This doesn’t (delete first 2 lines) am I going insane?
I think the preprocessor does not care for the comment characters and the
#pragma is still used as if it was not commented.
You can try this be adding a syntax error which will make your build fail and then have a look at the warnings.
I would not use the
<...> notation for the include.