Splitting cpp files

Yes. Since you defined them in another cpp file, the other cpp file doesn’t now anything about it (declaration of them missing). For this external global variable you need to use the extern declaration. add to screen.h:

#include <Arduino.h> // so that String is known
#include <Adafruit_PCD8544.h> //so that Adafruit_PCD8544  is known

//make the global variables from main.cpp visible
extern Adafruit_PCD8544 display;
extern String version;

See references:

2 Likes