Library objects are "not declared in scope" when moved from .ino to .cpp

Hello all. I've been breaking my program methods out into a .cpp and .h files before I do more programing and loose my mind doing it all in one file.

It's been going just fine, except for this one function uses objects and methods from the included library GxEPD_2. That's a library that controls the e-ink display I'm using.

The method works perfectly when it's in my .ino file. But as soon as it is moved into the .cpp file, that I've named methods.cpp, I get the error:
"In function 'void blindDefaultPage(int)': methods.cpp:19:5: error: 'display' was not declared in this scope"

So the method/function in question is "void blindDefaultPage(int _i)" and is the first one found in the "methods.cpp" file code below. The compiler is throwing many errors. All the same error about any line that starts with the object "display." and it says this "display." is not declared in this scope.

I've triple checked all my header and library include statements in each file. But it just keeps throwing this error at me. I've been asking myself what is different about the .ino file that allows it to work, but not in the .cpp file and I can not find the answer.

Right before posting this, I copied the function back over to the .ino file, and yep it works just fine. So I've done a good job isolating the problem to simply the location of this function being taken out of the .ino file and put into the .cpp file.

There must be something I don't know about how libraries include from elsewhere in the IDE interact with your .cpp file.
Thanks in advance for any help!

Here is the .ino file code... The function, named blindDefaultPage(), is no longer in here. it's in the .cpp I'll show next.

//file name ReadySender_V1.2_for_post.ino
#include "sendClass.h"
#include "methods.h"

#include <GxEPD2_BW.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Fonts/FreeMonoBold9pt7b.h>

#if defined(__AVR)
#define MAX_DISPLAY_BUFFER_SIZE 800
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
GxEPD2_BW<GxEPD2_213_B74, MAX_HEIGHT(GxEPD2_213_B74)> display(GxEPD2_213_B74(/*CS=*/ 9, /*DC=*/ 10, /*RST=8*/ -1, /*BUSY=7*/ 7)); // GDEM0213B74 122x250, SSD1680
//Busy control pad had to be wired to pin7 to be used instead of the -1 which set it to use default delay
#endif

int setupFlag = 1;
//------------------------------------------------------------------------------------------------------------------------------------------------------------
void setup() {
  setupFlag = 1;
  pinMode(vBatPin, INPUT);
  //display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
  display.init();
  display.setTextColor(GxEPD_BLACK);
  display.setRotation(3);
  display.cp437(true);//defeats some wierd bug related to fonts. Mentioned in Adafruit GFX library overview
  Serial.begin(9600);
  display.epd2.setBusyCallback(busyCallback); // register callback to be called during BUSY active time
}//END SETUP LOOP
//------------------------------------------------------------------------------------------------------------------------------------------------------------
void loop() {

  batVolt();
  voteSlotTiming();
  blindDefaultPage(setupFlag);
  buttMonPrint();

}//END MAIN LOOP
//------------------------------------------------------------------------------------------------------------------------------------------------------------

Now here is the code from the .cpp file named methods.cpp

//filename methods.cpp
#include "arduino.h"
#include "sendClass.h"// you have to make sure to include ALL header files that any code below refers to!
#include "methods.h"
#include <GxEPD2_BW.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Fonts/FreeMonoBold9pt7b.h>

buttBounce upButton(3);//This is the object creation declaration. This is where the parameters are passed to the class/constructor
buttBounce downButton(2);
buttBounce checkButton(A1);
buttBounce infoButton(A0);

#define vBatPin A6//the pin to analogRead for battery voltage
long vTime = 3600000;//1hour in milliseconds
float vBat = 0;
//------------------------------------------------------------------------------------------------------------------------------------------------------------
void blindDefaultPage(int _i) {
  if (_i == 1) {
    display.setFullWindow();
    display.firstPage();
    do {
      //display.fillScreen(GxEPD_WHITE);
      display.fillRect(0, 50, 150, 10, GxEPD_BLACK);
      display.setFont(&FreeMonoBold9pt7b);
      display.setCursor(20, 20);
      display.print("Next vote in    min");
    } while (display.nextPage());
    setupFlag = 0;
  }//END IF
  //------------------------------------------------------------------------------------------------------------------------------------------------------------
  int timeRemain = (vTime - millis()) / 60000; //as millis increases, this takes the difference between millis and vTime and converts it to minutes
  display.setPartialWindow(155, 5, 40, 20);
  display.firstPage();
  do {
    //display.drawRect(155,5,40,20, GxEPD_BLACK);
    int timeRemain = (vTime - millis()) / 60000; //as millis increases, this takes the difference between millis and vTime and converts it to minutes
    display.setFont(&FreeMonoBold9pt7b);
    display.setCursor(163, 20);
    display.println(timeRemain);

  } while (display.nextPage());
}//END blindDefaultPage FUNCTION
//------------------------------------------------------------------------------------------------------------------------------------------------------------
void buttMonPrint() {
  if (upButton.Debounce() == LOW) {
    Serial.println("upButton is pressed");
  }
  if (downButton.Debounce() == LOW) {
    Serial.println("downButton is pressed");
  }
  if (checkButton.Debounce() == LOW) {
    Serial.println("checkButton is pressed");
  }
  if (infoButton.Debounce() == LOW) {
    Serial.println("infoButton is pressed");
  }
}//END buttMonPrint
//------------------------------------------------------------------------------------------------------------------------------------------------------------
// busyCallback function called during waiting for BUSY to end, to service buttons
void busyCallback(const void* p)
{
  buttMonPrint();
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------
void batVolt() {
  vBat = analogRead(vBatPin);
  vBat *= 2; // we divided by 2, so multiply back
  vBat *= 3.3; // Multiply by 3.3V, our reference voltage
  vBat /= 1024; // convert to voltage
  //Serial.print("VBat: " ); Serial.println(measuredvbat);
}//END batVolt FUNCTION
//------------------------------------------------------------------------------------------------------------------------------------------------------------
void voteSlotTiming() {
  if (millis() >= vTime) {
    vTime = millis() + 3600000;//needs some way to flag and start timing from the time when the vote is actually cast!
    //voteAvail = true;
  }
}//End of voteSlotTiming FUNCTION
//------------------------------------------------------------------------------------------------------------------------------------------------------------
void rulerScreen() {

}//END rulerScreen

For completeness, here is the methods.h file code as well

//filename methods.h
#ifndef methods_h
#define methods_h
#include "arduino.h"

#define vBatPin A6//the pin to analogRead for battery voltage
extern long vTime;
extern int setupFlag;
extern float vBat;

void buttMonPrint();
void busyCallback(const void* p);//Remember that you have to include the parameter type!
void blindDefaultPage(int _i);
void voteSlotTiming();
void rulerScreen();
void batVolt();

#endif

There is also another .cpp and .h that contains my class functions
they are called sendClass.cpp and sendClass.h respectively.

//filename sendClass.cpp

#include "sendClass.h"
#include "methods.h"
#include "arduino.h"
#include <GxEPD2_BW.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Fonts/FreeMonoBoldOblique12pt7b.h>
#include <Fonts/FreeMonoBoldOblique9pt7b.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>

buttBounce::buttBounce(int pin) { //Constructor definition... starts with name of the class, then ::, then the constructor declaration name which should be the same as the class name
  //int pin is the parameter that is passed to this constructor (the constructor definition is kindof like the setup loop. Something that only happens once)
  pinMode(pin, INPUT_PULLUP);
  _pin = pin;//this pin variable is what is passed to the class when the object is created. Since it is public, we need to set the private _pin equal to pin
  //_lastButtonState=true;
  _debounceDelay = 50;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------
int buttBounce::Debounce() {
  //Debouce is the function name that is associated with the class and used with the obects that class has instantiated.
  //There can be other functions created in this .cpp file below that can also be used with the class's objects
  _buttonReading = digitalRead(_pin);
  if (_buttonReading != _lastButtonState) {//flags the exact time of a state change on the pin being read
    // at this exact state change moment, the debouncing timer is reset to current millis time
    _lastDebounceTime = millis();
  }

  if ((millis() - _lastDebounceTime) > _debounceDelay) {//if millis minus the last time there was a state chance is greater than the debounce delay, then...
    // whatever the reading is at, it's been there for longer than the debounce
    // delay, so take it as the actual current state:

    if (_buttonReading != _buttonState) {//only passes on if the button is actually different than last time millis went longer than the debounce delay
      _buttonState = _buttonReading;//sets the finalized state to the read button value

      // only do a thing if the new button state is LOW
      if (_buttonState == 1) {
        return 1;
      } else return 0;
    }
  }
  _lastButtonState = _buttonReading;
}//END buttDebounce FUNCTION

And last the sendClass.h file...

//filename sendClass.h

#ifndef sendClass_h
#define sendClass_h
#include "arduino.h"

class buttBounce {
  public://access specifier. functions and variables that can be used in the sketch
    buttBounce(int pin);//this is the "constructor declararion"... it must have the same name as the class does
    int Debounce();
  private://access specifier. functions and variables that can only be used in the class
    int _pin;
    int _buttonReading;
    int _lastButtonState = LOW;
    unsigned long _lastDebounceTime;
    int _debounceDelay;
    int _buttonState;
};   //yes this semicolon here is correct. definitely odd to see coming after a '}'

#endif

display is defined in file ReadySender_V1.2_for_post.ino
blindDefaultPage() in methods.cpp calls display methods
you need to declare display as extern in methods.cpp