Error compiling for board NodeMCU 1.0

Hi guys. I want to compile this code for nodemcu but getting error:
please help to fix. thanks

C:\Users\STRIX-PC\Documents\Arduino\libraries\arduino-FTP-master\src\FTP.cpp: In member function 'uint16_t FTP::waitServerCode(char*)':
C:\Users\STRIX-PC\Documents\Arduino\libraries\arduino-FTP-master\src\FTP.cpp:274:33: error: invalid conversion from 'char*' to 'uint8_t*' {aka 'unsigned char*'} [-fpermissive]
  274 |    buffLen += cClient.read(buff + buffLen, len);
      |                            ~~~~~^~~~~~~~~
      |                                 |
      |                                 char*
In file included from C:\Users\STRIX-PC\Documents\Arduino\libraries\arduino-FTP-master\src\FTP.h:5,
                 from C:\Users\STRIX-PC\Documents\Arduino\libraries\arduino-FTP-master\src\FTP.cpp:18:
C:\Users\STRIX-PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Client.h:35:35: note:   initializing argument 1 of 'virtual int Client::read(uint8_t*, size_t)'
   35 |         virtual int read(uint8_t *buf, size_t size) override = 0;
      |                          ~~~~~~~~~^~~
Multiple libraries were found for "SD.h"
 Used: C:\Users\STRIX-PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\SD
 Not used: C:\Program Files (x86)\Arduino\libraries\SD
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

the arduino sketch:

#include <SPI.h>
#include <SD.h>
#include <DHT.h>
#include <FTP.h>
#include <ESP8266WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <WiFiClient.h>

#define DHTPIN D2
#define DHTYPE DHT22
IPAddress server(192, 168, 1, 1);

WiFiClient ftpControl;
WiFiClient ftpData;
FTP ftp(ftpControl, ftpData);

const char *user = "anonymous";
const char *pass = "industrialShields";
const char *fileName = "FILE_NAME";

const int chipSelect = D8;
const int mq135 = A0;
DHT dht(DHTPIN, DHTYPE);

const char *ssid     = "PASTE SSID NAME";
const char *password = "PASTE PASSWORD";

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org");

#define SDREADLEDPIN D1

String weekDays[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
String months[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

float m = -0.6527;
float b = 1.30;
float R0 = 21.91;

void setup() {

  pinMode(mq135, INPUT);
  Serial.begin(115200);

  pinMode(SDREADLEDPIN, OUTPUT);
  digitalWrite(SDREADLEDPIN, LOW);

  while (!Serial) {
  }

  if (!SD.begin(chipSelect)) {
    Serial.println("Initialization failed!");
    while (1);
  }
  if (!ftp.connect(server, user, pass))
  {
    // Connection was wrong
    Serial.println("Unable to connect to the FTP server");
    while (true);
  }

  dht.begin();

  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  timeClient.begin();
  timeClient.setTimeOffset(19786);
}

void loop() {

  timeClient.update();

  double mq135_value = analogRead(mq135);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  unsigned long epochTime = timeClient.getEpochTime();
  String formattedTime = timeClient.getFormattedTime();
  int currentHour = timeClient.getHours();
  int currentMinute = timeClient.getMinutes();
  int currentSecond = timeClient.getSeconds();
  String weekDay = weekDays[timeClient.getDay()];
  struct tm *ptm = gmtime ((time_t *)&epochTime);
  int monthDay = ptm->tm_mday;
  int currentMonth = ptm->tm_mon + 1;
  String currentMonthName = months[currentMonth - 1];
  int currentYear = ptm->tm_year + 1900;
  String currentDate = String(currentYear) + "-" + String(currentMonth) + "-" + String(monthDay);

  String fullstring = String(weekDay) + "," + String(currentMonthName) + "," + String(monthDay) + "," + String(currentYear)   + "," +
                      String(currentHour) + "," + String(currentMinute) + "," + String(currentSecond) + "," +
                      String(t) + "," + String(h) + (",") + String(mq135_value);

  Serial.print("Full Data: ");
  Serial.println(fullstring);
  Serial.println("");
  delay(1000);

  File dataFile = SD.open("datalog.txt", FILE_WRITE);
  digitalWrite(SDREADLEDPIN, HIGH);
  if (dataFile) {
    dataFile.println(fullstring);
    dataFile.close();
    delay(1000);
    sendToFTP();
    digitalWrite(SDREADLEDPIN, LOW);
  }

  else {
    Serial.println("error opening datalog.txt");
  }
  delay(2000);
}

void sendToFTP(void)
{
  // Open the SD file
  File dataFile = SD.open("datalog.txt");

  // Check if the file was succesfully open
  if (dataFile)
  {
    Serial.println("Sending trough FTP connection");
    ftp.store("datalog.txt", dataFile);
    dataFile.close();
  }
  else
  {
    Serial.println("Error opening datalog.txt");
    while (true)
      ;
  }
}

My guess is that you have some incompatible libraries. It looks like the FTP library is using a 'char' buffer and the ESP8266WiFi library Client only accepts "uint8_t" buffers. You might be able to fix it by going into the FTP library and changing the buffer from 'char' to 'uint8_t'.

thanks for reply. I do that but not fixed. :frowning: can you help me how to upload the file from the SD card to FTP server ? the file named datalog.txt

here is my sketch:

#include "SPI.h"
#include "SD.h"
#include "DHT.h"
#include <ESP8266WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>

#define DHTPIN D2   
#define DHTYPE DHT22

const int chipSelect = D8; 
const int mq135 = A0;
DHT dht(DHTPIN, DHTYPE);

const char *ssid     = "PASTE SSID NAME";
const char *password = "PASTE PASSWORD";

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org");

#define SDREADLEDPIN D1 

String weekDays[7]={"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
String months[12]={"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

float m = -0.6527; 
float b = 1.30;  
float R0 = 21.91;

void setup() {

  pinMode(mq135, INPUT);
  Serial.begin(115200);
  
  pinMode(SDREADLEDPIN, OUTPUT);
  digitalWrite(SDREADLEDPIN, LOW);

    while (!Serial) {
  }

  if (!SD.begin(chipSelect)) {
    Serial.println("Initialization failed!");
    while (1);
  }

  dht.begin();
  
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  timeClient.begin();
  timeClient.setTimeOffset(19786);
}

void loop() {

  timeClient.update();

  double mq135_value = analogRead(mq135);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  unsigned long epochTime = timeClient.getEpochTime();
  String formattedTime = timeClient.getFormattedTime(); 
  int currentHour = timeClient.getHours();
  int currentMinute = timeClient.getMinutes();
  int currentSecond = timeClient.getSeconds();
  String weekDay = weekDays[timeClient.getDay()];    
  struct tm *ptm = gmtime ((time_t *)&epochTime); 
  int monthDay = ptm->tm_mday;
  int currentMonth = ptm->tm_mon+1;
  String currentMonthName = months[currentMonth-1];
  int currentYear = ptm->tm_year+1900;
  String currentDate = String(currentYear) + "-" + String(currentMonth) + "-" + String(monthDay);
  
  String fullstring = String(weekDay) + "," + String(currentMonthName) + "," + String(monthDay)+ "," + String(currentYear)   + "," + 
  String(currentHour) + "," + String(currentMinute) + "," + String(currentSecond) + "," + 
  String(t) + "," + String(h) + (",") + String(mq135_value);
  
  Serial.print("Full Data: ");
  Serial.println(fullstring);
  Serial.println("");
  delay(1000);
  
  File dataFile = SD.open("datalog.txt", FILE_WRITE);
  digitalWrite(SDREADLEDPIN, HIGH);
  if (dataFile) {
    dataFile.println(fullstring);
    dataFile.close();
    delay(1000);
    digitalWrite(SDREADLEDPIN, LOW);
  }
  
  else {
    Serial.println("error opening datalog.txt");
  }
  delay(2000);
}

Are you still getting the exact same error message as you shared above?

If so, please describe exactly what you did.

If not, please describe the new problem, including the full error message if you are still getting one.

I got this error after modify FTP.h lib:

In file included from C:\Users\STRIX-PC\Documents\Arduino\sketch_feb13b\sketch_feb13b.ino:4:
C:\Users\STRIX-PC\Documents\Arduino\libraries\arduino-FTP-master\src/FTP.h:1:2: error: invalid preprocessing directive #uint8_t
    1 | #uint8_t __FTP_H__
      |  ^~~~~~~
In file included from C:\Users\STRIX-PC\Documents\Arduino\sketch_feb13b\sketch_feb13b.ino:4:
C:\Users\STRIX-PC\Documents\Arduino\libraries\arduino-FTP-master\src/FTP.h:52:2: error: #endif without #if
   52 | #endif // __FTP_H__
      |  ^~~~~
Multiple libraries were found for "SD.h"
 Used: C:\Users\STRIX-PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\SD
 Not used: C:\Program Files (x86)\Arduino\libraries\SD
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

Show. the. modified. code.
You have obviously made an error in the modified code that we can't see.

Also look here.

I'm just modified the FTP lib not the sketch. What values should I change in the sketch?

Usually, the first line of a ".h" file would be more like"
#ifndef __FTP_H__
Did you change that line accidentally?!?

POST... YOUR.... CODE.....
You've been asked twice to show the modified code. Otherwise we are just guessing.

Last time.
SHOW US WHAT YOU MODIFIED.