[solved] no matching function for call to ‘TFT::TFT() when it worked before

I have installed a Jaycar 128x128 LCD colour Screen Module XC4629 (128x128 LCD Screen Module for Arduino | Jaycar Electronics) on a Duinotech Leonardo board. The data sheet says it is “supported by a library included with the Arduino IDE.” The TFT hardware seems to be similar to the (retired) Arduino LCD Screen (https://store.arduino.cc/usa/arduino-lcd-screen) although the Arduino screen is 160 x 128.

After quite a lot of research to work out which pins to use in order to use the SPI interface on the Leonardo, I successfully got a sketch working using some code from http://www.arduino.cc/en/Tutorial/TFTDisplayText and was able to clear the screen, set it to different colours, draw a circle and put text in various sizes on the screen.

Now when I go back to the same code and try to verify it, I get the error message:

“no matching function for call to ‘TFT::TFT(int, int, int)’’

I went back to the original code above (/Tutorial/TFTDisplayText) and loaded it unaltered.

When I try to verify this code in the IDE (using Chrome on Windows 10) I get the same function call error (ie even before attempting to upload). This implies to me that the something has changed in IDE environment and that the problem is not to do with my code or the hardware wiring on my board (which is still successfully running the previously successful code).

I have tried reinstalling the Arduino Create Agent. It seemed to install the same version (1.1.87-fca3237).

Is it possible that something has changed as a result of recent updates to my AVG firewall or version of Java?

I did a fair bit of google searching but no obvious answer.

Any clues folks?

<TFT.h> is a historic anomaly. It actually uses an obsolete version of the “Adafruit_ST7735.h” library.
Instead of using the intuitive Adafruit_GFX methods it uses a very weird set of graphics methods.

All the same, TFT.h comes with your Arduino IDE.
So it should work out of the box.

I have just installed IDE v1.8.9
The TFT.h examples build and run fine on a 3.3V Uno clone and on a Due clone.

I don’t have a 3.3V Leonardo. So I can’t use a Red 3.3V ST7735 display like the one in your link.
However, I can set my “Board” to “Leonardo” and compile the examples.

I strongly recommend that you install the current Adafruit_ST7735 and Adafruit_GFX libraries via the IDE Library Manager.

Connect your 3.3V display to a 5V Leonardo via level-shifters.
This can be series resistors, potential dividers, dedicated integrated circuits, …

Not difficult but it is “too much like hard work” for me.
I always use proper 3.3V electronics. It makes life easier.

I note that your JayCar link does not show the pcb side of the display. It is quite possible that it contains level-shifting hardware. But it “looks” like regular Chinese Red 128x128 displays (which contain a 3.3V regulator but require 3.3V logic)


Here's the clue to the problem:

Multiple libraries were found for "TFT.h"

Used: /home/builder/opt/libraries/latest/tft_touch_shield_v1_0_1_0_2

Not used: /home/builder/opt/libraries/latest/tft_1_0_6

Unlike the standard Arduino IDE, the Arduino Web Editor comes with all the 2188 libraries in the Arduino Library Manager index pre-installed. This is a mixed blessing in that there will often be multiple libraries that contain a file matching #include directives for generic filenames such as "TFT.h". The IDE does make some efforts to pick the right library, but it often gets it wrong. New libraries are added weekly, so a code that compiles one day may break the next.

Fortunately, the Arduino Web Editor does have some provisions for influencing which library it will use. Do this:

  • Click the "Libraries" tab.
  • In the "Libraries" tab, click the "Default" tab. These are the official Arduino libraries.
  • In the "Search Libraries" input field, type "tft".
  • Press Enter.
  • In the search results, you will see the TFT library listed. This is the library the code was written for. Hover the mouse pointer over the TFT search result.
  • You will now see an "Include" button. Click the downward pointing triangle on the right side of the "Include" button.
  • From the dropdown menu, click on "Version 1.0.6".

This will add some metadata to a hidden file of the sketch, which tells the Arduino Web Editor to use version 1.0.6 of the official Arduino TFT library. The sketch should now compile without errors.

Awesome, thanks Pert. That worked fine, at least to the extent that my previously working code is now validating and uploading. The display is no longer displaying, but that could be a wiring or code problem. At least with the code uploading I can troubleshoot. The only thing to add to your very precise and clear instructions is that this seems to need to be done for each sketch that has the

#include <TFT.h>
  • ie it is not a default setting, it is specific to the individual code.

You're welcome. I'm glad if I was able to be of assistance. I hope you'll be able to get your display working soon.

You're correct that the process must be repeated for each sketch. The information is written to a hidden metadata file which is local to the individual sketch.

I am intrigued. The regular Red 128x128 display from Ebay looks like:

Note that there are very few components. My one contains a GalaxyCore GC9101 which is "similar" to Sitronix ST7735S.

The pcb has a 3.3V regulator (U1) but it still needs 3.3V logic. It will not be happy with 5V logic from a Leonardo. Five 2k2 series resistors are cheap and easy to use.

Of course your Australian display may be different.

TFT.h is a deprecated library. Yes, I am sure that it will "work". But it is not very "future-proof"

I suggest that you use "Adafruit_ST7735.h" which is supported and maintained by Adafruit.


I am not sure how to tell if my Leonardo is 3.3V or 5V, I didnt know it came in two flavours. Mine is a Duinotech Leonardo r3 and it has sockets labelled both 3.3V and 5V
Attached are photos of the back of Jaycar XC-4629 “128x128 Colour TFT-LCD Diplay for Arduino”

Thanks for the photos. Your pcb looks pretty "White" to me. The pcb in #5 looks "Red".

The photo in your JayCar link:

looks "Red" to me. However the yellow pin header has got 11 pins.
I assumed it was a Red pcb with yellow 8-pin header.

Anyway, please ignore all my worries about 5V logic.

Your 11-pin header will plug straight into the Analog and Power header sockets of your Leonardo.
This is very convenient but requires using software SPI.

Or you can hand-wire to the Leonardo hardware SPI pins. Messy wires but it will be faster.

The 74HC245 chip shifts from Leonardo 5V logic to 3.3V logic on the ST7735 controller.

My apologies. I should have noticed 11-pins and not assumed "red pcb with 8-pin yellow header"

Life would have been much easier if JayCar had provided a pcb photo.


Edit. Updated the Jaycar image

I would expect the Adafruit library examples to work with your Leonardo (or ANY Arduino)
Start with the graphictest.ino example from the Adafruit_ST7735 library

  1. try the Software constructor first.
// OPTION 2 lets you interface the display using ANY TWO or THREE PINS,
// tradeoff being that performance is not as fast as hardware SPI above.
//#define TFT_MOSI 11  // Data out
//#define TFT_SCLK 13  // Clock out
//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
  1. then try the hardware constructor
// OPTION 1 (recommended) is to use the HARDWARE SPI pins, which are unique
// to each board and not reassignable. For Arduino Uno: MOSI = pin 11 and
// SCLK = pin 13. This is the fastest mode of operation and is required if
// using the breakout board's microSD card.

// For 1.44" and 1.8" TFT with ST7735 (including HalloWing) use:
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

Note that the Hardware SPI pins on a Leonardo are on the 3x2 ICSP header:

#define TFT_MOSI 16  // Data out
#define TFT_SCLK 15  // Clock out

I possess a Leonardo but only have 3.3V ST7735 displays.
I can assure you that the 3.3V display works on every 3.3V board that I own.

I would be 99.5% certain that the Adafruit examples will work on your hardware.

Please paste your complete actual sketch i.e. with your edits.

Or just quote the example name with your #define and constructor statements.

Important question: Jaycar photo shows a Red board. Your photo shows a white board. Which is correct?