I have created a library Lib
that doesn't have a class. I want this library to have a variable that can be accessed from outside. The way I would go about this is to just declare them in the header file.
However, if I do this like so:
int myVariable = 1;
with the .cpp
-file containing only
#include "Lib.h"
I get this error message when compiling an empty sketch that includes this library:
multiple definition of `myVariable'
and for some weird reason
Multiple libraries were found for "Lib.h"
on top of that (although, this is something I have encountered before - when there is some error during the compilation, this error may come alongside it, even though there are no multiple libraries; it goes away when the other compilation errors are resolved aswell).
What is causing that error and how to resolve it?
const int myVariable = 1;
if it is a constant