Compile error - cannot convert 'String' to 'const char*'
Posted: Fri Jan 22, 2016 10:49 pm
I am trying to run the Wifi Scanner example from - https://www.hackster.io/rayburne/warwalking-a9c021
It would not compile after downloading it, I had to insert function prototypes. Then I commented out a few bits and got it mostly going but stuck with a strcpy function giving a compile error.
Error is "WiFiScanOpen:108: error: cannot convert 'String' to 'const char*' for argument '2' to 'char* strcpy(char*, const char*)' strcpy (WiFiSSID, WiFi.SSID(i));"
Relevant code snippits are
I also get compiler warnings for lines like the following, but they don't stop it compiling or running.
Warning is
WiFiScanOpen.ino:77:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] sendStrXY("No Nets in Range", ln++, 0);
Can anyone help?
It would not compile after downloading it, I had to insert function prototypes. Then I commented out a few bits and got it mostly going but stuck with a strcpy function giving a compile error.
Error is "WiFiScanOpen:108: error: cannot convert 'String' to 'const char*' for argument '2' to 'char* strcpy(char*, const char*)' strcpy (WiFiSSID, WiFi.SSID(i));"
Relevant code snippits are
Code: Select all
#include "ESP8266WiFi.h"
...
int n = WiFi.scanNetworks();
...
strcpy (WiFSSID, WiFi.SSID(i)); <== This line giving the compile error, it is inside a for loop for i
I also get compiler warnings for lines like the following, but they don't stop it compiling or running.
Code: Select all
sendStrXY("No Nets in Range", ln++, 0);
Warning is
WiFiScanOpen.ino:77:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] sendStrXY("No Nets in Range", ln++, 0);
Can anyone help?