I have a class that runs the TFT touch screen. screenObj
This works wonderful.
Now, I'd like to make a global, screen; that is an instance of this class. I can do this in my sketch, but then I need to pass it into any objects constructors that wants to access it. This works, but its not the best. And it sucks up memory.
I'd like to place this gloabl somewhere like in the screenObj.h file so its automatically available to my sketch & all the subclasses and bits I write later that want to access it.
This doesn't seem to work as I thought. If I put the global in the screenObj.h I get all sorts of errors about multiple definitions.
gauge.cpp.o:(.bss.screen+0x0): multiple definition of `screen'
drawObj.cpp.o:drawObj.cpp:35: first defined here
label.cpp.o:(.bss.screen+0x0): multiple definition of `screen'
drawObj.cpp.o:drawObj.cpp:35: first defined here
screenObj.cpp.o:(.bss.screen+0x0): multiple definition of `screen'
drawObj.cpp.o:drawObj.cpp:35: first defined here
Even though I use the
#ifndef screenObj_h
#define screenObj_h
at the top with the #endif at the bottom.
Any hints?
Thanks!!
-jim lee