Undefined reference to "method of my class"

Why I receive this error?

.pio\build\esp32dev\src\main.cpp.o:(.literal._Z5setupv+0x88): undefined reference to `EEprom_Utility::Istanzia_EEprom(int)’

Here the code:

You’re doing C++ classes very wrong. When you have a header file with

class EEprom_Utility {

  public:
    bool Istanzia_EEprom(int Dimensione_EEprom);
    String Formatta(String Nome_Variabile, String Contenuto_Variabile, byte Lunghezza_Campo, bool Debug);
    String Leggi (int _address_Begin, int _address_End, bool Debug);
    bool Scrivi(String Nome_Variabile, String Contenuto_Variabile, int Indirizzo_Begin, int Indirizzo_End, bool Debug);

};

Then the accompanying .cpp file must not again create a class EEprom_Utility {} but just include the header file and implement the functions like

#include "Factory.h"
bool EEprom_Utility::Istanzia_EEprom(int Dimensione_EEprom) {
   /* implementation */
}

I took the liberty to correct the mistakes and auto-format the source code (Ctrl+Shift+P → Format Document). See https://drive.google.com/file/d/1U-gW2kaEN5gJ-Rv4XkI31n4GIsTytT6G/view?usp=sharing

For more reading on C++ class programming, please read

1 Like

Many thanks for help!
I have used a wrong template taken from chatGPT…

One more reason to learn coding for real instead of taking questionable results from a neural network.

1 Like

Just curious, could you ask chatGPT to fix the issue? Does it provide the correct answer?

If it have create a wrong structure of class (example template) I don’t thing that it will create working code…