'class Watchy' has no member named 'getHeightData'

Hey everyone, I'm having trouble with figuring out the source of this error

'class Watchy' has no member named 'getHeightData'

Here is the code for .ino:

#include <Watchy.h> //include the Watchy library
#include <Fonts/FreeMonoOblique24pt7b.h> //include any fonts you want to use

class MyFirstWatchFace : public Watchy{ //inherit and extend Watchy class
        Watchy face;
        void drawWatchFace(){ //override this method to customize how the watch face looks
          display.setCursor(25, 110);

MyFirstWatchFace m; //instantiate your watchface

void setup() {
  m.init(); //call init in setup

void loop() {
  // this should never run, Watchy deep sleeps after init();

A snippet from the header file:

#ifndef WATCHY_H
#define WATCHY_H

#include <Arduino.h>
#include <WiFiManager.h>
#include <HTTPClient.h>
#include <Arduino_JSON.h>
#include <DS3232RTC.h>
#include <GxEPD2_BW.h>
#include <Wire.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include "DSEG7_Classic_Bold_53.h"
#include "BLE.h"
#include "bma.h"
#include "config.h"    

typedef struct weatherData{
    int8_t temperature;
    int16_t weatherConditionCode;

class Watchy {
        static DS3232RTC RTC;
        static GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display;
        tmElements_t currentTime;
        void init(String datetime = "");
        void deepSleep();
        float getBatteryVoltage();
        void vibMotor(uint8_t intervalMs = 100, uint8_t length = 20);
        int getHeightData();
        void handleButtonPress();
        void showMenu(byte menuIndex, bool partialRefresh);
        void showFastMenu(byte menuIndex);
        void showBattery();
        void showBuzz();
        void showAccelerometer();
        void showUpdateFW();
        void setTime();
        void setupWifi();
        bool connectWiFi();
        weatherData getWeatherData();
        void updateFWBegin();

        void showWatchFace(bool partialRefresh);
        virtual void drawWatchFace(); //override this method for different watch faces

        void _rtcConfig(String datetime);    
        void _bmaConfig();
        static void _configModeCallback(WiFiManager *myWiFiManager);
        static uint16_t _readRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len);
        static uint16_t _writeRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len);

And a snippet from the cpp file

int Watchy::getHeightData()
    int height = 0;
            HTTPClient http;
            http.setConnectTimeout(3000);//3 second max timeout
            String queryURL = String("http://api.blockcypher.com/v1/btc/main");
            int httpResponseCode = http.GET();
            if(httpResponseCode == 200) 
                String payload = http.getString();
                JSONVar responseObject = JSON.parse(payload);
                height = int(responseObject["height"]);
       return height;   
    return height;

I'm unsure as to why it does not recognize this member. Have I initialized it properly?

Can you post the full compiler error including line numbers etc?
Why do you need a face instance of the superclass? Isn’t your face just the current instance (this) ?


WARNING: library DS3232RTC claims to run on avr architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s).
C:\Users\User\Documents\Arduino\blockheight_tester22\blockheight_tester22.ino: In member function 'virtual void MyFirstWatchFace::drawWatchFace()':
blockheight_tester22:13:30: error: 'class Watchy' has no member named 'getHeightData'
Multiple libraries were found for "WiFi.h"
 Used: C:\Users\User\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi
 Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.49.0_x86__mdqgnx93n4wtt\libraries\WiFi
exit status 1
'class Watchy' has no member named 'getHeightData'

And sorry, I'm not super familiar with Arduino and C++, should it just be



Could even be just 'getHeightData()' because MyFirstWatchFace is a kind of Watchy and inherits the behaviors of Watchy.

My guess is that the "#include <Watchy.h>" is using the wrong "Watchy.h" somehow. If you turn on verbose build messages (in Preferences) you will see which libraries it is finding.

Thank you John! Turns out the files my .ino were calling were in another directory with files of the same name! I made sure to add my changes there instead and it worked.

You might want to read a bit more about classes in C++