Since .ino files are an arduino thing and I’ve been trying to get as close to standard C++ as I can anticipating the switch out of the arduino environment. I decided to change all my project’s .ino files except the main one to .cpp files. So now I’ve got one .ino, four .cpp and five .h files. My .ino file has a #include for all the .h files.
I started off with a bunch of errors. I don’t fully understand why, but I was able to fix some of them.
- I had to add what I believe are called forward declarations since some structures and functions are used globally in my project. These are like function prototypes, but for functions in other cpp files.
- I had a user library which no longer worked with #include “my_lib” but did with #include <my_lib>. Which is odd since I thought <> was just for built in libraries.
- I had to put all my #includes in my .ino file. This seemed odd, since if A requires B and B requires C, why can’t B import C? Why does A have to import everything that any other file might need. Doesn’t seem much like encapsulation to me.
Now I’ve got a function I use throughout my code to log messages to the SD card. Here’s the prototype:
void log_msgL(unsigned char logLevel,const __FlashStringHelper *format, ... );
I now get an error “ISO C++ forbids declaration of ‘__FlashStringHelper’ with no type” and I have no idea what to do, except go back to all ino files. All the answers on this error I can find talk about namespaces. Will I need to dig thought the arduino code to find how __FlashStringHelper is declared?