Exit error, what do i do?

In file included from C:\Users\Doug\Documents\Arduino\libraries\MCUFRIEND_kbv\MCUFRIEND_kbv.cpp:38:
C:\Users\Doug\Documents\Arduino\libraries\MCUFRIEND_kbv\utility/mcufriend_shield.h: In function 'void write_8(uint16_t)':
C:\Users\Doug\Documents\Arduino\libraries\MCUFRIEND_kbv\utility/mcufriend_shield.h:1084:5: error: 'GPIO' was not declared in this scope
1084 | GPIO.out_w1tc = map_8(0xFF); //could define once as DMASK
| ^~~~
C:\Users\Doug\Documents\Arduino\libraries\MCUFRIEND_kbv\utility/mcufriend_shield.h: In function 'uint8_t read_8()':
C:\Users\Doug\Documents\Arduino\libraries\MCUFRIEND_kbv\utility/mcufriend_shield.h:1090:19: error: 'GPIO' was not declared in this scope
1090 | return map_32(GPIO.in);
| ^~~~
Multiple libraries were found for "SD.h"
Used: C:\Users\Doug\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.1\libraries\SD
Not used: C:\Users\Doug\AppData\Local\Arduino15\libraries\SD
exit status 1

Compilation error: exit status 1

Hi @digdoug7131815. Some other users who encountered this problem reported a solution here:

https://github.com/prenticedavid/MCUFRIEND_kbv/issues/255#issuecomment-2258971273

In utility/mcufriend_shield.h after line 1025 I added the include, like as follows:

1024	//################################### ESP32 >##############################
1025	#elif defined(ESP32)       //regular UNO shield on TTGO D1 R32 (ESP32)
1026
1027	#include "hal/gpio_ll.h" // GPIO register functions
1028
1029	#define LCD_RD  2  //LED
1030	#define LCD_WR  4

I'll provide more detailed instructions:

  1. Use any text editor to open the file at this path on your hard drive:
    C:\Users\Doug\Documents\Arduino\libraries\MCUFRIEND_kbv\utility/mcufriend_shield.h
    
  2. Scroll down to line 1025 of the file:
    #elif defined(ESP32)
    
  3. Add a new line after that line.
  4. Add the following code at that new line 1026:
    #include "hal/gpio_ll.h" // GPIO register functions
    
  5. Save the file.

Now try compiling or uploading the sketch again, just as you did before when you encountered that "'GPIO' was not declared in this scope" error. Hopefully this time it will work as expected.