arduino-libraries / TFT

TFT Library for Arduino
http://arduino.cc/
GNU Lesser General Public License v2.1
56 stars 41 forks source link

The SD library was not found. loadImage() and image() won't be supported. #2

Open karlosss opened 8 years ago

karlosss commented 8 years ago

When I run the following code snippet, i get this warning. Should I be afraid of it if I want to use images in the future? Nothing changes when I include <SD.h>.

#include <TFT.h>
#include <SPI.h>
#include <Esplora.h>

void setup(){
    EsploraTFT.begin(); 
    EsploraTFT.background(0,0,0);
    delay(1000);
}

void loop(){
    EsploraTFT.stroke(255,255,255);
    EsploraTFT.fill(255,255,255);
    EsploraTFT.setTextSize(3);
    EsploraTFT.text("ashfahdsfkjahsdkfjhalkds", 0, 0);

}
per1234 commented 7 years ago

It's not clear from reading @karlosss issue report but this warning does still appear even if you include SD.h before including TFT.h. Here is the minimal demonstration code:

#include <SD.h>
#include <TFT.h>

void setup() {}

void loop() {}

And the warnings from Arduino IDE 1.8.3:

In file included from E:\ArduinoIDE\arduino-1.8.3\libraries\TFT\src\TFT.h:36:0,

                 from E:\ArduinoIDE\arduino-1.8.3\libraries\TFT\src\TFT.cpp:32:

E:\ArduinoIDE\arduino-1.8.3\libraries\TFT\src\utility/Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp]

  #warning "The SD library was not found. loadImage() and image() won't be supported."

   ^

In file included from E:\ArduinoIDE\arduino-1.8.3\libraries\TFT\src\utility\Adafruit_GFX.cpp:34:0:

E:\ArduinoIDE\arduino-1.8.3\libraries\TFT\src\utility\Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp]

  #warning "The SD library was not found. loadImage() and image() won't be supported."

   ^

In file included from E:\ArduinoIDE\arduino-1.8.3\libraries\TFT\src\utility\Adafruit_ST7735.h:28:0,

                 from E:\ArduinoIDE\arduino-1.8.3\libraries\TFT\src\utility\Adafruit_ST7735.cpp:19:

E:\ArduinoIDE\arduino-1.8.3\libraries\TFT\src\utility\Adafruit_GFX.h:60:3: warning: #warning "The SD library was not found. loadImage() and image() won't be supported." [-Wcpp]

  #warning "The SD library was not found. loadImage() and image() won't be supported."

The problem is that the warning is triggered if the SD library include guard macro __SD_H__ is not defined. It is defined during the include from the sketch since it previously included SD.h but the macro is not defined when Adafruit_GFX.h is also included from the separate translation units of Adafruit_GFX.cpp and Adafruit_ST7735.cpp.

B1Z1 commented 3 years ago

Hello, @per1234 any solutions about this?