How the sketch find library?

Hi everyone.
The sketch below has: #include "TFT_eSPI.h" , I have TFT_eSPI.h under :TTGO-T-Display-master/TFT_eSPI/
got compiling error of: TFT_eSPI.h: No such file or directory
how to fix please.
Thanks
Adam

#include "config.h"
/// #include <Arduino.h>
#ifdef ENABLE_DISPLAY
#include "TFT_eSPI.h"
#endif
#include "SiRFGPS.h"
#include "GPS.h"

#ifdef USES_SIRF
SiRFGPS *gps;
#else
GPS *gps;
#endif
#ifdef ENABLE_DISPLAY
TFT_eSPI display;
#endif

void setup()
{
  Serial.begin(115200);
#ifdef ENABLE_DISPLAY
  display.begin();
  display.setRotation(1);
  display.fillScreen(0);
  display.setCursor(0, 0, 2);
  display.setTextColor(TFT_WHITE, TFT_BLACK);
  display.setTextSize(1);
#endif
#ifdef USES_SIRF
  gps = new SiRFGPS(GPS_SERIAL, GPS_TX, GPS_RX, GPS_ENABLE);
  gps->begin();
#else
  gps = new GPS(GPS_SERIAL, GPS_TX, GPS_RX);
  gps->begin(GPS_BAUD);
#endif
}

void loop()
{
  Serial.printf("%s\n", gps->get_fix().toString().c_str());
#ifdef ENABLE_DISPLAY
  display.fillScreen(0);
  display.setCursor(0, 0, 2);
  Serial.printf(gps->get_fix().toString().c_str());
  display.println(gps->get_fix().toString().c_str());
  display.fillScreen(0);
  display.setCursor(0, 0, 2);
  display.printf("Tracking %d of %d visible\n", gps->get_tracking_satellites(), gps->get_visibile_satellites());
  display.printf("Status: %s\n", gps->get_status() == 'A' ? "LOCK!" : "SEARCHING...");
  display.printf("Time: %s\n", gps->get_fix().timestamp.toString().c_str());
  display.printf("Lat: %f\n", gps->get_fix().latitude);
  display.printf("Lng: %f\n", gps->get_fix().longitude);
  display.printf("Speed: %f\n", gps->get_fix().speed);
  display.printf("Almanac: %.1f%% complete\n", gps->get_fix().almanac.percentComplete());
#endif
  delay(5000);
}

ERROR:

Arduino: 1.8.19 (Windows 10), Board: "TTGO LoRa32-OLED, TTGO LoRa32 V1 (No TFCard), 80MHz, 921600, None, Disabled"


src_TTGO:18:10: fatal error: TFT_eSPI.h: No such file or directory

 #include "TFT_eSPI.h"

          ^~~~~~~~~~~~

compilation terminated.

exit status 1

TFT_eSPI.h: No such file or directory



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Where is TTGO-T-Display-master/TFT_eSPI/ ? Is it under your project directory or the Arduino library directory?

If its in the libraries directory, then you probably want:

#include <TFT_eSPI.h>
1 Like

Make sure any new library is in Liraries, along with all the other libraries.
If you have just installed the new library, restart Arduino IDE, otherwise it still won't find it.

1 Like

Thanks.
it was #include <TFT_eSPI.h>

Thanks.
restarted IDE, same.

@shanren please answer the question:

TFT_eSPI.h

This library is available through the library manager. I would delete the library from TTGO-T-Display-master/TFT_eSPI/ and download from the library manager. I will go to the correct library folder.

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