Typedefs and defines

Hi guys, I'm trying to get a typedef declaration to "work" in the arduino IDE. The code is:

typedef byte myType[MY_LENGTH]

With MY_LENGTH being a simple #define.

The IDE gave me some errors so thank to Google I discovered an old thread here where a guy said that, due to some preprocessor black magic done by the build process, typedefs must be written in an external file (he was suggesting a ".h" file).

The problem is that when I put my typedef in a ".h" file, included at the top of the .ino file, the compiler says "byte" is not declared. So I can I solve this problem? Is there some header file I can include to be able to use arduino's data types in my plain c/c++ header file?

Thanks in advance, 3mpty

3mpty:
So I can I solve this problem? Is there some header file I can include to be able to use arduino’s data types in my plain c/c++ header file?

I’d guess you want something like:

#include  <Arduino.h>

Hope this helps,

Brad.

EDIT: Erp, typo. And even worse, I think that’s the wrong advice. Sorry, that’s what I get for thinking.

you will need a ; at the end of that declaration. try "Arduino.h"

LOL now I feel kinda stupid for having missed Arduino.h eheh :D Brad, I owe you a beer ;)

@kiwimew: The missing ";" was due to retyping instead of copy-pasting from the source ;) Thank you anyway