I have written a very simple library - similar to the “Keybord” or “Mouse” library - with an “extern” declaration of a fix object inside the h-file. This fix object “LED13” is the error source: “…LED13static.ino:8: undefined reference to `LED13’” at compile time.
What is wrong? The two very simple library files (LED13S.cpp and LED13S.h) and the using also simple sketch (LED13static.ino) are attached.
SurferTim:
You could have removed both those from LED13S.h and LED13S.cpp, and added this to your sketch.
LED13S LED13;
And I would argue that you should. Unlike HardwareSerial creating, properly, an instance of HardwareSerial called Serial, your library pre-creating an instance does not feel value added.