TFT function not working with 5 parameters

I'm using arduino due with a sensor and arduino TFT display. I have used the SPI for the sensor and have been trying to use other available pins on the DUE as SPI for the TFT display. From this link I came to know the code to be used for using alternate SPI pins. When I use the code

#define SCLK 4
#define MOSI 5
#define CS   6
#define DC   7
#define RESET 8

TFT myScreen = TFT(CS, DC, MOSI, SCLK, RESET);

I get the following error: no matching function for call to 'TFT::TFT(int, int, int, int, int)'

Please help me get the easiest way around using SPI for both the devices.

SPI pins (SCLK, Mosi, Miso) can be shared with different devices. Only the CS (Chip Select) has to be unique and this is pulled low when the data on the other pins is intended for target device, then set back on high to free the bus.

If you publish you entire code, so it is clear which library you are using, maybe you get a fuller answer.

Please post the full error message. At the moment all we know is that the TFT library that you are using does not take 5 integers as parameters when creating an instance of the TFT object

The Due only supports a few pins as CS for hardware SPI, namely 4,10 and 52, you must specifiy one of those (whether you use it or not) as its a hardware requirement.

Does the TFT library do its SPI purely in software then?

The code is:

// include the necessary libraries
#include 
#include 
#include   // Arduino LCD library

// pin definition for the Due                 
#define sd_cs  7
#define dc     9
#define rst    8
//the following pins are assigned values for alternate SPI pins
#define lcd_cs 52 //before, the value given was 10
#define sclk  12 //using other pins instead of hardware SPI pins
#define mosi 11 //using other pins instead of hardware SPI pins
//miso is on pin 5

TFT TFTscreen = TFT(lcd_cs, dc, mosi, sclk, rst);
// this variable represents the image to be drawn on screen
PImage logo;


void setup() {
  // initialize the GLCD and show a message
  // asking the user to open the serial line
  //  TFTscreen.begin();
  TFTscreen.background(255, 0, 255);

  TFTscreen.stroke(0, 0, 255);
  TFTscreen.println();
  TFTscreen.println(F("Arduino TFT Bitmap Example"));
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.println(F("Open serial monitor"));
  TFTscreen.println(F("to run the sketch"));
   delay(1500);

  // initialize the serial port: it will be used to
  // print some diagnostic info
  Serial.begin(9600);
  while (!Serial) {
    // wait for serial port to connect. Needed for native USB port only
  }

  // clear the GLCD screen before starting
  TFTscreen.background(255, 255, 255);

  // try to access the SD card. If that fails (e.g.
  // no card present), the setup process will stop.
  Serial.print(F("Initializing SD card..."));
  if (!SD.begin(sd_cs)) {
    Serial.println(F("failed!"));
    return;
  }
  Serial.println(F("OK!"));

  // initialize and clear the GLCD screen
  //  TFTscreen.begin();
  TFTscreen.background(255, 255, 255);

  // now that the SD card can be access, try to load the
  // image file.
  logo = TFTscreen.loadImage("4.bmp");//24 bit image stored in sd card
  if (!logo.isValid()) {
    Serial.println(F("error while loading arduino.bmp"));
  }
}

void loop() {
  // don't do anything if the image wasn't loaded correctly.
  if (logo.isValid() == false) {
    return;
  }

  Serial.println(F("drawing image"));

  // get a random location where to draw the image.
  // To avoid the image to be draw outside the screen,
  // take into account the image size.
  int x = (TFTscreen.width() - logo.width())/2;
  int y = (TFTscreen.height() - logo.height())/2;

  // draw the image to the screen
  TFTscreen.image(logo, x, y);

  // wait a little bit before drawing again
  delay(1500);
}

The error I got is:

Arduino: 1.8.5 (Windows 7), Board: "Arduino Due (Programming Port)"

In file included from C:\Users\sz\Documents\Arduino\libraries\TFT\src/TFT.h:36:0,

                 from C:\Users\sz\Documents\Arduino\sketch_aug21a\sketch_aug21a.ino:4:

C:\Users\sz\Documents\Arduino\libraries\TFT\src/utility/Adafruit_GFX.h: In static member function 'static PImage PImage::loadImage(const char*)':

C:\Users\sz\Documents\Arduino\libraries\TFT\src/utility/Adafruit_GFX.h:318:40: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]

   if ((bmpFile = SD.open(fileName)) == NULL) {

                                        ^

C:\Users\sz\Documents\Arduino\sketch_aug21a\sketch_aug21a.ino: At global scope:

sketch_aug21a:16: error: no matching function for call to 'TFT::TFT(int, int, int, int, int)'

 TFT TFTscreen = TFT(lcd_cs, dc, mosi, sclk, rst);

                                                ^

C:\Users\sz\Documents\Arduino\sketch_aug21a\sketch_aug21a.ino:16:48: note: candidates are:

In file included from C:\Users\sz\Documents\Arduino\sketch_aug21a\sketch_aug21a.ino:4:0:

C:\Users\sz\Documents\Arduino\libraries\TFT\src/TFT.h:47:3: note: TFT::TFT(uint8_t, uint8_t, uint8_t)

   TFT(uint8_t CS, uint8_t RS, uint8_t RST);

   ^

C:\Users\sz\Documents\Arduino\libraries\TFT\src/TFT.h:47:3: note:   candidate expects 3 arguments, 5 provided

C:\Users\sz\Documents\Arduino\libraries\TFT\src/TFT.h:45:7: note: constexpr TFT::TFT(const TFT&)

 class TFT : public Adafruit_ST7735 {

       ^

C:\Users\sz\Documents\Arduino\libraries\TFT\src/TFT.h:45:7: note:   candidate expects 1 argument, 5 provided

C:\Users\sz\Documents\Arduino\libraries\TFT\src/TFT.h:45:7: note: constexpr TFT::TFT(TFT&&)

C:\Users\sz\Documents\Arduino\libraries\TFT\src/TFT.h:45:7: note:   candidate expects 1 argument, 5 provided

Multiple libraries were found for "TFT.h"
 Used: C:\Users\sz\Documents\Arduino\libraries\TFT
 Not used: C:\Program Files (x86)\Arduino\libraries\TFT
exit status 1
no matching function for call to 'TFT::TFT(int, int, int, int, int)'

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