[Solved!]Creating a simple own library - and get a compiler error

Hello to the specialists.

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.

LED13S.h (201 Bytes)

LED13S.cpp (913 Bytes)

LED13static.ino (243 Bytes)

You've said that the class will be instanced in some other file - that's what extern means.

What other file did you declare the instance in? I must have missed it.

If you are going to use this in LED13S.h

extern LED13S LED13;

You must use this in LED13S.cpp

LED13S LED13;

To Surfer Tim: Many thanks!! That is my fault. With your help it is solved in less than two hours.

You could have removed both those from LED13S.h and LED13S.cpp, and added this to your sketch.

LED13S LED13;

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.