invalid conversion from 'char*' to 'uint16_t {aka short unsigned int}' [-fpermis

Hello good mornig for everyone! I am trying to use the WifiManager library to save the data of my MQTT connection, but when I intend to start the client I receive the error "invalid conversion from 'char *' to 'uint16_t {aka short unsigned int}' [-fpermissive]"

I leave my code and I will be very grateful to anyone who can help me or suggest a change in the code

Im using ArduinoJson from Blanchon version 5.7.3, Ive tryed others, and Wifimanager 0.12.0

I couldnt post the hole code

THANKS

//Define Adafruit connection data
char MQTT_SERV[45] = "";
char MQTT_PORT[30] = "";
char MQTT_NAME[20] = "";
char MQTT_PASS[10] = "";

HERE IS THE ERROR
>>>>Adafruit_MQTT_Client mqtt(&client, MQTT_SERV, MQTT_PORT, MQTT_NAME, MQTT_PASS);

Adafruit_MQTT_Subscribe notifications = Adafruit_MQTT_Subscribe(&mqtt, MQTT_NAME "/f/notifications");

WiFiManager wifiManager;
  wifiManager.setAPCallback(configModeCallback);
  wifiManager.setSaveConfigCallback(saveConfigCallback);
  // Adding an additional config on the WIFI manager webpage for the API Key and Channel ID
  WiFiManagerParameter customMqtt_Serv("mqtt_serv", "MQTT SERVER", MQTT_SERV, 50);
  WiFiManagerParameter customMqtt_Port("mqtt_port", "MQTT PORT", MQTT_PORT, 35);
  WiFiManagerParameter customMqtt_Name("mqtt_name", "MQTT USERNAME", MQTT_NAME, 25);
  WiFiManagerParameter customMqtt_Pass("mqtt_pass", "MQTT PASSWORD", MQTT_PASS, 15);
  wifiManager.addParameter(&customMqtt_Serv);
  wifiManager.addParameter(&customMqtt_Port);
  wifiManager.addParameter(&customMqtt_Name);
  wifiManager.addParameter(&customMqtt_Pass);


    strcpy(MQTT_SERV, customMqtt_Serv.getValue());
    strcpy(MQTT_PORT, customMqtt_Port.getValue());
    strcpy(MQTT_NAME, customMqtt_Name.getValue());
    strcpy(MQTT_PASS, customMqtt_Pass.getValue());

bool loadConfig() {
  File configFile = SPIFFS.open("/config.json", "r");
  if (!configFile) {
    Serial.println("Failed to open config file");
    return false;
  }

  size_t size = configFile.size();
  if (size > 1024) {
    Serial.println("Config file size is too large");
    return false;
  }

  // Allocate a buffer to store contents of the file.
  std::unique_ptr<char[]> buf(new char[size]);

  configFile.readBytes(buf.get(), size);

  StaticJsonBuffer<200> jsonBuffer;
  JsonObject& json = jsonBuffer.parseObject(buf.get());

  if (!json.success()) {
    Serial.println("Failed to parse config file");
    return false;
  }

  strcpy(MQTT_SERV, json["mqtt_serv"]);
  strcpy(MQTT_PORT, json["mqtt_port"]);
  strcpy(MQTT_NAME, json["mqtt_name"]);
  strcpy(MQTT_PASS, json["mqtt_pass"]);
  return true;
}

bool saveConfig() {
  StaticJsonBuffer<200> jsonBuffer;
  JsonObject& json = jsonBuffer.createObject();
  json["mqtt_serv"] = MQTT_SERV;
  json["mqtt_port"] = MQTT_PORT;
  json["mqtt_name"] = MQTT_NAME;
  json["mqtt_pass"] = MQTT_PASS;

  File configFile = SPIFFS.open("/config.json", "w");
  if (!configFile) {
    Serial.println("Failed to open config file for writing");
    return false;
  }

  json.printTo(configFile);
  return true;
}

The third parameter passed to the Adafruit_MQTT_Client constructor (the port number) needs to be a uint16_t. You're passing it a char *.

gfvalvo:
The third parameter passed to the Adafruit_MQTT_Client constructor (the port number) needs to be a uint16_t. You're passing it a char *.

Hi gfgalvo, thank for replay! How do i hace to change the code to correct this? I do y know much about programming

Thanks

Try following the example sketches that come with the Adafruit MQTT Library.