ThingPulse / esp8266-oled-ssd1306

Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
https://thingpulse.com
Other
1.99k stars 637 forks source link

(Not really a bug report)Defining progmem arrays in header file #276

Closed rdragonrydr closed 3 years ago

rdragonrydr commented 4 years ago

In everything else I've had to work with, and my own code, it seems that data arrays need to be declared extern in the .h file and then defined in the .cpp file. But here, the fonts are defined and declared in the .h file, and the linker doesn't give multiple-definitions-of errors, even in the same project where it will give that error if I try to do it. In both cases the file in question is, at least indirectly, included in several other files, causing it to give errors that the array is defined "in a file included by..." and all eventually pointing to the original .h file.

Can someone please explain by what method you were able to do this? It would be extremely useful to me, and I can't find anything out about this and no one else seems to know how this is even possible.

I refer to the OLEDDisplayFonts.h file. If I try to make a font file with my own fonts, even if I copy this one exactly except for the array contents, it gives me linker errors. Help?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.