Undefined reference to: ESP32 Error

Hello everyone,
I am trying to include some variables in a function that is called "TouchInterface" and to run it in the loop function, the variables are strings that I want to have in the other function (TouchInterface) to do some conditionals with those, but I got the standard error "Error compiling for ESP32 Dev Module", I tried to put the loop function in many different parts and searched, but the questions that I found were for people that have .h files, and I don't have any of it, here is the error messages

Arduino: 1.8.19 (Windows 10), Board: "ESP32 Dev Module, Disabled, Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

sketch\ESP32_DISPLAY_V1.ino.cpp.o:(.literal._Z4loopv+0xc): undefined reference to `touchInterfaz()'

sketch\ESP32_DISPLAY_V1.ino.cpp.o: In function `loop()':

C:\Users\david\Downloads\ESP32_DISPLAY_V1/ESP32_DISPLAY_V1.ino:500: undefined reference to `touchInterfaz()'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board ESP32 Dev Module.

And here is the code

#include "FS.h"
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI();
#include "teclado.h"
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_STMPE610.h>
//-------------------DISPLAY--------------------------
#define CALIBRATION_FILE "/TouchCalData3"
#define REPEAT_CAL false
#define TS_MINX 150
#define TS_MINY 130
#define TS_MAXX 3800
#define TS_MAXY 4000
#define FRAME_X 52
#define FRAME_Y 94
#define FRAME_W 135
#define FRAME_H 235

#define REDBUTTON_X FRAME_X
#define REDBUTTON_Y FRAME_Y
#define REDBUTTON_W FRAME_W
#define REDBUTTON_H FRAME_H

void touchInterfaz();
void imagenInterfaz();
void imagenBoton();
//-------------------RELE------------------------------
#define pinRele_1 32
#define pinRele_2 35
#define pinRele_3 34

int m  = 0;
int s  = 60;
int tm = 0;
int ts = 0;
int retraso;
bool estado = false;
int numc = 1;
  int m1  = 0;
  int m2  = 0;
  int m3  = 0;
  int m4  = 0;
  int m5  = 0;
  int m6  = 0;
  int m7  = 0;
  int m8  = 0;
  int m9  = 0;
  int m10 = 0;
  int m11 = 0;
  int m12 = 0;


//****************************************************************************************
void setup() {
  Serial.begin(9600);
  //----------------------------------------------------
  pinMode(ledWifi, OUTPUT);
  digitalWrite(ledWifi, HIGH);
  //---------------------
  pinMode(pinRele_1, OUTPUT);
  pinMode(pinRele_2, OUTPUT);
  pinMode(pinRele_3, OUTPUT);
  digitalWrite(pinRele_1, LOW);
  digitalWrite(pinRele_2, LOW);
  digitalWrite(pinRele_3, LOW);
  //----------------------------------------------------
  tft.begin();

  tft.setRotation(0);
  tft.setSwapBytes(true);
  uint16_t calData[5] = { 303, 3452, 412, 3382, 4 };
  tft.setTouch(calData);
  tft.fillScreen(TFT_WHITE);
  imagenInterfaz();
}
//******************************************************************************************

void loop() {
  touchInterfaz();
  String strg1  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg2  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg3  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg4  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg5  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg6  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg7  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg8  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg9  = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg10 = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg11 = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
  String strg12 = String(0) + ":" + String(0) + ":" + String(m1) + ":" + String(60);
}

//------------------------------------------------------------------------------------------
//FUNCION DECLARACION DE TECLAS DE DISPLAY
void imagenBoton() {
  tft.fillRoundRect(puntoX, puntoY, 110, 42, 2, TFT_WHITE);
  tft.drawRoundRect(puntoX, puntoY, 110, 42, 2, TFT_BLACK);
}
void imagenBoton3() {
  tft.fillRoundRect(puntoX, puntoY, 80, 42, 2, TFT_WHITE);
  tft.drawRoundRect(puntoX, puntoY, 80, 42, 2, TFT_BLACK);
}

void imagenBoton1() {
  tft.fillRoundRect(puntoX, puntoY, 52, 42, 2, TFT_WHITE);
  tft.drawRoundRect(puntoX, puntoY, 52, 42, 2, TFT_BLACK);
}

void touchInterfaz(String &strg1, String &strg2, String &strg3, String &strg4, String &strg5, String &strg6, String &strg7, String &strg8, String &strg9, String &strg10, String &strg11, String &strg12) {
  //FUNCION PARA BOTON EN SEGUNDO PLANO
  if (tft.getTouch(&x, &y))
  {

    //----------------------------------- -
    if (x > 124 && x < 169 && y > 46 && y < 88 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 124; puntoY = 46;
      delay(1000);
      if (numc == 1) {
         m1--;
      }
      //-----------------
    }          
    //----------------------------------- +
    if (x > 182 && x < 227 && y > 46 && y < 88 ) {
      while(1 == 1) {
        m1++;
      }
      puntoX = 182; puntoY = 46;
    }

    //----------------------------------- STEP //57
    if (x > 64 && x < 121 && y > 44 && y < 88 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      estado = true;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    while (estado == true) {
      for (;;) {
        s--;
        while (s > 0) {
          while (m > 0) {
            delay(1000);
            if (s == 0) {
              s = 60;
              m = m - 1;
              s--;
            }
            if (m == 0 && s == 0) {
              s = 0;
              m = 0;
              estado = false;
            }
          }
          bool b = false;

        }
      }
    }

    //----------------------------------PROG
    if (x > 7 && x < 52 && y > 94 && y < 141 ) {
      //-----------------
      puntoX = 7; puntoY = 94;
      imagenBoton1();
      x = 0;
      y = 0;
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
      tft.setTextSize(2);
      tft.setCursor(10, 5);
      tft.print("Can.");
      tft.setCursor(55, 5);
      tft.print(numc);
      //-----------------
      
    switch (numc) {
      case 1:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg1);
        break;

      case 2:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg1);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg2);
        break;

      case 3:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg2);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg3);
        break;
      case 4:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg3);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg4);
        break;
      case 5:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg4);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg5);
        break;
      case 6:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg5);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg6);
        break;
      case 7:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg6);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg7);
        break;
      case 8:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg7);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg8);
        break;
      case 9:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg8);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg9);
        break;
      case 10:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg9);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg10);
        break;
      case 11:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg10);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg11);
        break;
      case 12:
        tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGREEN);
        tft.setCursor(10, 22);
        tft.print(strg11);
        tft.setTextSize(2);
        tft.setCursor(125, 22);
        tft.print(strg12);
        break;
    }
  }
    //----------------------------------- VAC
    if (x > 66 && x < 121 && y > 94 && y < 141 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 66; puntoY = 95;
      imagenBoton1();
      delay(100);
      imagenInterfaz();

      //-----------------
    }

    //----------------------------------- -   // RPD
    if (x > 130 && x < 230 && y > 95 && y < 138 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 130; puntoY = 95;
      imagenBoton();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------AS
    if (x > 7 && x < 52 && y > 151 && y < 201 ) {
      //-----------------
      puntoX = 7; puntoY = 139;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------- MS
    if (x > 66 && x < 121 && y > 152 && y < 201 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 66; puntoY = 139;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------- -   // ENTER
    if (x > 130 && x < 230 && y > 152 && y < 201 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      if (numc <= 11) {
        numc = numc + 1;
      }
      puntoX = 128; puntoY = 139;
      imagenBoton();
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------CLOCK
    if (x > 7 && x < 52 && y > 216 && y < 264 ) {
      //-----------------
      tft.setTextColor(ILI9341_WHITE);
      tft.setTextSize(2);
      tft.setCursor(15, 15); // x yu
      m = tm;
      s = ts;

      //-----------------
    }

    //----------------------------------- ST
    if (x > 64 && x < 121 && y > 216 && y < 264 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 64; puntoY = 185;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------- -   DD
    if (x > 124 && x < 169 && y > 216 && y < 264 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 124; puntoY = 185;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }
    //----------------------------------- DO
    if (x > 182 && x < 227 && y > 216 && y < 264 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 182; puntoY = 185;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }


    //----------------------------------ROTATE
    if (x > 7 && x < 52 && y > 285 && y < 300 ) {
      //-----------------
      puntoX = 7; puntoY = 231;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------- RAISE
    if (x > 64 && x < 121 && y > 285 && y < 300 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 64; puntoY = 231;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------- -   // LOWER
    if (x > 124 && x < 169 && y > 285 && y < 300 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 124; puntoY = 231;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }
    //----------------------------------- GO TO
    if (x > 182 && x < 227 && y > 285 && y < 300 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 182; puntoY = 231;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------CF
    if (x > 7 && x < 52 && y > 315 && y < 353) {
      //-----------------
      puntoX = 7; puntoY = 270;
      imagenBoton1();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //----------------------------------- ES
    if (x > 64 && x < 150 && y > 315 && y < 353 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 64; puntoY = 270;
      imagenBoton3();
      delay(100);
      imagenInterfaz();
      //-----------------
    }

    //-----------------------------------   CA
    if (x > 153 && x < 300 && y > 315 && y < 353 ) {
      //-----------------
      digitalWrite(pinRele_1, LOW);
      digitalWrite(pinRele_2, LOW);
      digitalWrite(pinRele_3, LOW);
      //-----------------
      puntoX = 145; puntoY = 270;
      imagenBoton3();
      delay(100);
      imagenInterfaz();
    }
  }//FIN tft.getTouch
}
//------------------------------------------------------------------------------------------
//REFRESCO DE DISPLAY
void imagenInterfaz() {
  tft.pushImage(0, 0, animation_width, animation_height, frame);
}
//------------------------------------------------------------------------------------------

This is my first question, please tell me what is wrong with the question and how to make better ones, and any help would be nice, Thanks.

Please post the entire sketch, no matter how long. We need to see where 'touchInterfaz()' is defined.

Verbal descriptions are too error prone.

There is the code, I know all the names are in Spanish, and I am also working with an ILI9341 but that is not my focus and this topic focus, I just need the touchInterfaz function and the variables to be working properly

Okay, you are the doctor so you can cure yourself.

Then please read the forum guidelines and find out.

I now start to think that some of the error messages say that Adafruit_GFX_master.h is not used and I have 2 of them:
image
one that is master and another that doesn't I am going to see what happens if I delete one of them

Yes, it can possibly be a library installation problem...

I already change it, It did get me out of one error, but the undefined reference is still on

Then please post your entire sketch. It's a forum standard procedure.

There it is, in the question, there is the full code dunno what do you mean there

Thank you.

There is the error message (I am going to delete the gfx error right now) and the full code

Have you read the forum introductory guideline documents yet?

By the way, never go back and edit previous posts. It destroys the sense of any other peoples answers. Post in a new message instead.

ok, thanks for that

It's very simple. Your function prototype and implementation do not have the same number of parameters.

1 Like

Like aarag said touchInterfaz is expecting 5 strings so when you call it you have to provide 5 strings.

But I have 12 parameters there, I don't know what you guys mean

Also in your comments you have a section of implementations, you call them declarations.

//FUNCION DECLARACION DE TECLAS DE DISPLAY

Count the parameters here:

void touchInterfaz();