Multiple files in Web IDE - uint8_t (or byte) not known?

I have used separate header files in the Web IDE before, but I have to admit to having shoe-horned all my code into the .INO file every time. Yes, not great programming style I know.

So, now, a completely new program, so let’s do it right and put my support functions in a separate library file.

In my INO file I have my includes

#include “ZC_Declarations.h”
#include “ZC_Lib.h”
#include “ZC_Lib.cpp”

But when I compile I get shoals of errors as if ZC_LIB.cpp has never heard of all the built in data types etc. For example:

ZC_Lib.cpp:67:3: ‘uint8_t’ was not declared in this scope

Line 67 contains:

uint8_t calculatedCkSum = 0;

Even if I convert it to

byte calculatedCkSum = 0;

Still get the error, it just says byte is an unknown.

Some kind of inheritance issue? I’m sure that - as this is my first try at this - I am suffering a fundamental misunderstanding of how this should work - but can’t find anything that seems to apply. Should that ZC_Lib file be a .INO? Cant find a way to rename it if so…

Thanks any any help with this.

You need to include Particle.h (directly or indirectly) into any file you are using these types or Particle specific functions/classes/…

You only didn’t need to do that in your .ino file because the Wiring preprocessor does that for you if you fail to do it explicitly.


Ah! Right got it!
Thanks ScruffR

1 Like

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