Arduino gfx library issues

hi. im using the arduino gfx library, my issue is with the library rather than my display. when i call the function :

 gfx->setAddrWindow((gfx->width() - VIDEO_WIDTH) / 2, (gfx->height() - VIDEO_HEIGHT) / 2, VIDEO_WIDTH, VIDEO_HEIGHT);

the compiler throws up the error:

'class Arduino_GFX' has no member named 'setAddrWindow'

i partially understand this. inside the Arduino gfx library, there is multiple header and cpp files; arduino_GFX.h, and also a head file called Arduino_TFT. although the function 'setAddrWindow' is not inside of the arduino gfx.h, it is inside of Arduino_TFT.cpp so, how do i call it? thanks.
my code:

#define VIDEO_WIDTH 220L
#define VIDEO_HEIGHT 176L
#define RGB565_FILENAME "/220_9fps.rgb"
#define RGB565_BUFFER_SIZE (VIDEO_WIDTH * VIDEO_HEIGHT * 2)
#include <SD.h>
#include <SD_MMC.h>


#include <Arduino_G.h>
#include <Arduino_GFX.h>

#include <Arduino_DataBus.h>
#include <Arduino_GFX_Library.h>
#include <Arduino_TFT.cpp>
#include <Arduino_TFT.h>
#include <Arduino_TFT_18bit.h>
#include <gfxfont.h>
#define TFT_BRIGHTNESS 128

void setup()
{
  Serial.begin(115200);
pinMode(5,OUTPUT);
digitalWrite( 5, HIGH); // SD card chips select, must use GPIO 5 (ESP32 SS)
pinMode(21,OUTPUT);
digitalWrite(21, HIGH); // SD card chips select, must use GPIO 5 (ESP32 SS)
Arduino_DataBus *bus = new Arduino_HWSPI(2 /* DC */, 15 /* CS */);
Arduino_GFX *gfx = new Arduino_ILI9341(bus, 4 /* RST */);
  // Init Video
 
  gfx->begin();
  gfx->fillScreen(BLACK);

#ifdef TFT_BL
    ledcAttachPin(TFT_BL, 1); // assign TFT_BL pin to channel 1
    ledcSetup(1, 12000, 8);   // 12 kHz PWM, 8-bit resolution
    ledcWrite(1, TFT_BRIGHTNESS);  // brightness 0 - 255
#endif

  // Init SD card
  if (!SD.begin(SS, SPI, 80000000)) /* SPI bus mode */
  // if ((!SD_MMC.begin()) && (!SD_MMC.begin())) /* 4-bit SD bus mode */
  // if ((!SD_MMC.begin("/sdcard", true)) && (!SD_MMC.begin("/sdcard", true))) /* 1-bit SD bus mode */
  {
    Serial.println(F("ERROR: SD card mount failed!"));
    gfx->println(F("ERROR: SD card mount failed!"));
  }
  else
  {
    File vFile = SD.open(RGB565_FILENAME);
    // File vFile = SD_MMC.open(RGB565_FILENAME);
    if (!vFile || vFile.isDirectory())
    {
      Serial.println(F("ERROR: Failed to open " RGB565_FILENAME " file for reading"));
      gfx->println(F("ERROR: Failed to open " RGB565_FILENAME " file for reading"));
    }
    else
    {
      uint8_t *buf = (uint8_t *)malloc(RGB565_BUFFER_SIZE);
      if (!buf)
      {
        Serial.println(F("buf malloc failed!"));
      }
      else
      {
        Serial.println(F("RGB565 video start"));
        gfx->setAddrWindow((gfx->width() - VIDEO_WIDTH) / 2, (gfx->height() - VIDEO_HEIGHT) / 2, VIDEO_WIDTH, VIDEO_HEIGHT);
        while (vFile.available())
        {
          // Read video
          uint32_t l = vFile.read(buf, RGB565_BUFFER_SIZE);

          // Play video
          gfx->startWrite();
          gfx->writeBytes(buf, l);
          gfx->endWrite();
        }
        Serial.println(F("RGB565 video end"));
        vFile.close();
      }
    }
  }
#ifdef TFT_BL
  delay(60000);
  ledcDetachPin(TFT_BL);
#endif
  gfx->displayOff();
  esp_deep_sleep_start();
}

void loop()
{
}

the library if you dont know it:

Why do you want to call it ?

Hello

class Arduino_TFT : public Arduino_GFX

It means the Arduino_TFT class inherits from all the methods and members of the Arduino_GFX class.

So the Arduino_TFT class is like an extension of the Arduino_GFX class, and you can safely replace Arduino_GFX *gfx by Arduino_TFT *gfx, then you will have access to methods like setAddrWindow. And you can rename the gfx variable with a better name like display or tft

But you should put these declarations (bus and gfx) outside of setup(), so you can use these variables in loop()

Edit: you can replace with Arduino_ILI9341 *display because the Arduino_ILI9341 class is an extension of the Arduino_TFT class

hi thanks for the fast reply. i tried this

and the compiler threw up loads of errors:

c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::startWrite()':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:45: multiple definition of `Arduino_TFT::startWrite()'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:45: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writePixelPreclipped(short, short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:50: multiple definition of `Arduino_TFT::writePixelPreclipped(short, short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:50: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeRepeat(unsigned short, unsigned int)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:56: multiple definition of `Arduino_TFT::writeRepeat(unsigned short, unsigned int)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:56: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeFillRectPreclipped(short, short, short, short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:168: multiple definition of `Arduino_TFT::writeFillRectPreclipped(short, short, short, short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:168: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::endWrite()':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:177: multiple definition of `Arduino_TFT::endWrite()'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:177: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeColor(unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:226: multiple definition of `Arduino_TFT::writeColor(unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:226: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writePixels(unsigned short*, unsigned int)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:239: multiple definition of `Arduino_TFT::writePixels(unsigned short*, unsigned int)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:239: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeSlashLine(short, short, short, short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:268: multiple definition of `Arduino_TFT::writeSlashLine(short, short, short, short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:268: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeIndexedPixels(unsigned char*, unsigned short*, unsigned int)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:331: multiple definition of `Arduino_TFT::writeIndexedPixels(unsigned char*, unsigned short*, unsigned int)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:331: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeIndexedPixelsDouble(unsigned char*, unsigned short*, unsigned int)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:345: multiple definition of `Arduino_TFT::writeIndexedPixelsDouble(unsigned char*, unsigned short*, unsigned int)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:345: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeFastVLine(short, short, short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:74: multiple definition of `Arduino_TFT::writeFastVLine(short, short, short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:74: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeFastHLine(short, short, short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:117: multiple definition of `Arduino_TFT::writeFastHLine(short, short, short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:117: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::Arduino_TFT(Arduino_DataBus*, signed char, unsigned char, bool, short, short, unsigned char, unsigned char, unsigned char, unsigned char)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:10: multiple definition of `Arduino_TFT::Arduino_TFT(Arduino_DataBus*, signed char, unsigned char, bool, short, short, unsigned char, unsigned char, unsigned char, unsigned char)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:10: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::Arduino_TFT(Arduino_DataBus*, signed char, unsigned char, bool, short, short, unsigned char, unsigned char, unsigned char, unsigned char)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:10: multiple definition of `Arduino_TFT::Arduino_TFT(Arduino_DataBus*, signed char, unsigned char, bool, short, short, unsigned char, unsigned char, unsigned char, unsigned char)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:10: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::setAddrWindow(short, short, unsigned short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:183: multiple definition of `Arduino_TFT::setAddrWindow(short, short, unsigned short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:183: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::begin(int)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:29: multiple definition of `Arduino_TFT::begin(int)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:29: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `non-virtual thunk to Arduino_TFT::begin(int)':
Arduino_TFT.cpp:(.text._ZThn8_N11Arduino_TFT5beginEi+0x0): multiple definition of `non-virtual thunk to Arduino_TFT::begin(int)'; sketch\tftvideo.ino.cpp.o:tftvideo.ino.cpp:(.text._ZThn8_N11Arduino_TFT5beginEi+0x0): first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::writeBytes(unsigned char*, unsigned int)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:234: multiple definition of `Arduino_TFT::writeBytes(unsigned char*, unsigned int)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:234: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::pushColor(unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:250: multiple definition of `Arduino_TFT::pushColor(unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:250: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::setRotation(unsigned char)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:198: multiple definition of `Arduino_TFT::setRotation(unsigned char)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:198: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::drawBitmap(short, short, unsigned char const*, short, short, unsigned short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:364: multiple definition of `Arduino_TFT::drawBitmap(short, short, unsigned char const*, short, short, unsigned short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:364: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::drawBitmap(short, short, unsigned char*, short, short, unsigned short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:420: multiple definition of `Arduino_TFT::drawBitmap(short, short, unsigned char*, short, short, unsigned short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:420: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `non-virtual thunk to Arduino_TFT::drawBitmap(short, short, unsigned char*, short, short, unsigned short, unsigned short)':
Arduino_TFT.cpp:(.text._ZThn8_N11Arduino_TFT10drawBitmapEssPhsstt+0x0): multiple definition of `non-virtual thunk to Arduino_TFT::drawBitmap(short, short, unsigned char*, short, short, unsigned short, unsigned short)'; sketch\tftvideo.ino.cpp.o:tftvideo.ino.cpp:(.text._ZThn8_N11Arduino_TFT10drawBitmapEssPhsstt+0x0): first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::drawGrayscaleBitmap(short, short, unsigned char const*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:473: multiple definition of `Arduino_TFT::drawGrayscaleBitmap(short, short, unsigned char const*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:473: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::drawGrayscaleBitmap(short, short, unsigned char*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:519: multiple definition of `Arduino_TFT::drawGrayscaleBitmap(short, short, unsigned char*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:519: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::drawIndexedBitmap(short, short, unsigned char*, unsigned short*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:566: multiple definition of `Arduino_TFT::drawIndexedBitmap(short, short, unsigned char*, unsigned short*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:566: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `non-virtual thunk to Arduino_TFT::drawIndexedBitmap(short, short, unsigned char*, unsigned short*, short, short)':
Arduino_TFT.cpp:(.text._ZThn8_N11Arduino_TFT17drawIndexedBitmapEssPhPtss+0x0): multiple definition of `non-virtual thunk to Arduino_TFT::drawIndexedBitmap(short, short, unsigned char*, unsigned short*, short, short)'; sketch\tftvideo.ino.cpp.o:tftvideo.ino.cpp:(.text._ZThn8_N11Arduino_TFT17drawIndexedBitmapEssPhPtss+0x0): first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::draw16bitRGBBitmap(short, short, unsigned short*, unsigned char*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:610: multiple definition of `Arduino_TFT::draw16bitRGBBitmap(short, short, unsigned short*, unsigned char*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:610: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::draw16bitRGBBitmap(short, short, unsigned short const*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:685: multiple definition of `Arduino_TFT::draw16bitRGBBitmap(short, short, unsigned short const*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:685: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::draw16bitRGBBitmap(short, short, unsigned short*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:730: multiple definition of `Arduino_TFT::draw16bitRGBBitmap(short, short, unsigned short*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:730: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `non-virtual thunk to Arduino_TFT::draw16bitRGBBitmap(short, short, unsigned short*, short, short)':
Arduino_TFT.cpp:(.text._ZThn8_N11Arduino_TFT18draw16bitRGBBitmapEssPtss+0x0): multiple definition of `non-virtual thunk to Arduino_TFT::draw16bitRGBBitmap(short, short, unsigned short*, short, short)'; sketch\tftvideo.ino.cpp.o:tftvideo.ino.cpp:(.text._ZThn8_N11Arduino_TFT18draw16bitRGBBitmapEssPtss+0x0): first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::draw16bitBeRGBBitmap(short, short, unsigned short*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:771: multiple definition of `Arduino_TFT::draw16bitBeRGBBitmap(short, short, unsigned short*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:771: first defined here
Multiple libraries were found for "SD.h"
 Used: C:\Users\Abby\Documents\Arduino\libraries\SD
 Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries\SD
 Not used: C:\Users\Abby\Documents\ArduinoData\packages\esp32\hardware\esp32\2.0.2\libraries\SD
Multiple libraries were found for "SD_MMC.h"
 Used: C:\Users\Abby\Documents\Arduino\libraries\SD_MMC
 Not used: C:\Users\Abby\Documents\ArduinoData\packages\esp32\hardware\esp32\2.0.2\libraries\SD_MMC
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::draw24bitRGBBitmap(short, short, unsigned char const*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:811: multiple definition of `Arduino_TFT::draw24bitRGBBitmap(short, short, unsigned char const*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:811: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::draw24bitRGBBitmap(short, short, unsigned char*, short, short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:857: multiple definition of `Arduino_TFT::draw24bitRGBBitmap(short, short, unsigned char*, short, short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:857: first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `non-virtual thunk to Arduino_TFT::draw24bitRGBBitmap(short, short, unsigned char*, short, short)':
Arduino_TFT.cpp:(.text._ZThn8_N11Arduino_TFT18draw24bitRGBBitmapEssPhss+0x0): multiple definition of `non-virtual thunk to Arduino_TFT::draw24bitRGBBitmap(short, short, unsigned char*, short, short)'; sketch\tftvideo.ino.cpp.o:tftvideo.ino.cpp:(.text._ZThn8_N11Arduino_TFT18draw24bitRGBBitmapEssPhss+0x0): first defined here
c:/users/abby/documents/arduinodata/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\Arduino_GFX-master\Arduino_TFT.cpp.o: in function `Arduino_TFT::drawChar(short, short, unsigned char, unsigned short, unsigned short)':
C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:903: multiple definition of `Arduino_TFT::drawChar(short, short, unsigned char, unsigned short, unsigned short)'; sketch\tftvideo.ino.cpp.o:C:\Users\Abby\Documents\Arduino\libraries\Arduino_GFX-master\src/Arduino_TFT.cpp:903: first defined here
collect2.exe: error: ld returned 1 exit status

my new code:

#define VIDEO_WIDTH 220L
#define VIDEO_HEIGHT 176L
#define RGB565_FILENAME "/220_9fps.rgb"
#define RGB565_BUFFER_SIZE (VIDEO_WIDTH * VIDEO_HEIGHT * 2)
#include <SD.h>
#include <SD_MMC.h>


#include <Arduino_G.h>
#include <Arduino_GFX.h>

#include <Arduino_DataBus.h>
#include <Arduino_GFX_Library.h>
#include <Arduino_TFT.cpp>
#include <Arduino_TFT.h>
#include <Arduino_TFT_18bit.h>
#include <gfxfont.h>
#define TFT_BRIGHTNESS 128

void setup()
{
  Serial.begin(115200);
pinMode(5,OUTPUT);
digitalWrite( 5, HIGH); // SD card chips select, must use GPIO 5 (ESP32 SS)
pinMode(21,OUTPUT);
digitalWrite(21, HIGH); // SD card chips select, must use GPIO 5 (ESP32 SS)
Arduino_DataBus *bus = new Arduino_HWSPI(2 /* DC */, 15 /* CS */);
Arduino_TFT *gfx = new Arduino_ILI9341(bus, 4 /* RST */);
  // Init Video
 
  gfx->begin();
  gfx->fillScreen(BLACK);

#ifdef TFT_BL
    ledcAttachPin(TFT_BL, 1); // assign TFT_BL pin to channel 1
    ledcSetup(1, 12000, 8);   // 12 kHz PWM, 8-bit resolution
    ledcWrite(1, TFT_BRIGHTNESS);  // brightness 0 - 255
#endif

  // Init SD card
  if (!SD.begin(SS, SPI, 80000000)) /* SPI bus mode */
  // if ((!SD_MMC.begin()) && (!SD_MMC.begin())) /* 4-bit SD bus mode */
  // if ((!SD_MMC.begin("/sdcard", true)) && (!SD_MMC.begin("/sdcard", true))) /* 1-bit SD bus mode */
  {
    Serial.println(F("ERROR: SD card mount failed!"));
    gfx->println(F("ERROR: SD card mount failed!"));
  }
  else
  {
    File vFile = SD.open(RGB565_FILENAME);
    // File vFile = SD_MMC.open(RGB565_FILENAME);
    if (!vFile || vFile.isDirectory())
    {
      Serial.println(F("ERROR: Failed to open " RGB565_FILENAME " file for reading"));
      gfx->println(F("ERROR: Failed to open " RGB565_FILENAME " file for reading"));
    }
    else
    {
      uint8_t *buf = (uint8_t *)malloc(RGB565_BUFFER_SIZE);
      if (!buf)
      {
        Serial.println(F("buf malloc failed!"));
      }
      else
      {
        Serial.println(F("RGB565 video start"));
        gfx->setAddrWindow((gfx->width() - VIDEO_WIDTH) / 2, (gfx->height() - VIDEO_HEIGHT) / 2, VIDEO_WIDTH, VIDEO_HEIGHT);
        while (vFile.available())
        {
          // Read video
          uint32_t l = vFile.read(buf, RGB565_BUFFER_SIZE);

          // Play video
          gfx->startWrite();
          gfx->writeBytes(buf, l);
          gfx->endWrite();
        }
        Serial.println(F("RGB565 video end"));
        vFile.close();
      }
    }
  }
#ifdef TFT_BL
  delay(60000);
  ledcDetachPin(TFT_BL);
#endif
  gfx->displayOff();
  esp_deep_sleep_start();
}

void loop()
{
}

im trying to display video on a 3.2" ili9341 240x320 display

Could you use a library written for that screen ?

possibly, its more if i can actually display videos with that library whereas the library im using now has a dedicated tutorial on displaying videos:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.