Using .h and .cpp files in same directory as sketch

PeterH:
Variables should be defined in .cpp files. The definition means, in effect: allocate some memory to hold a Button, name it helloButton and initialise it to this value ...

Button helloButton = Button(2, LOW);

If you need to access a variable from other files, you should add an external declaration in a header file and include that wherever you need to access it. The external declaration means, in effect: the symbol helloButton refers to a Button which is defined in some other file ...

extern Button helloButton;

In this case you don't refer to helloButton from outside MyLib.cpp so you don't actually need the external declaration.

That's a big help. Because I moved

Button helloButton = Button(2, LOW);

to the .ino file per the previous suggestion. But I got this compile error:
MyLip.cpp: In function 'void readbutton()':
MyLip.cpp:5: error: 'helloButton' was not declared in this scope

So if I add to MyLip.cpp this:

extern Button helloButton;

Then it compiles fine.