[SOLVED] Deprecated conversion from string constant to 'char*' [-Wwrite-strings] Ubidots client(TOKEN);


#1

Hello i’m interessted in Ubidots.

So i made an account, and made an project with one variable.
Use a Arduino with ESP8266 connected.
Installed the EP8266 library, and started Arduino IDE 1.8.0 again.
Used the example code to save 1 variable,
Replaced the SSID (Wifi-name) and password.
Also replaced the token and variableID.

Uploaded the software to my Arduino, and get a warning:
deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] Ubidots client(TOKEN);

I’ve looked in the forum but didn’t find a tread discussin this.

Because i have also an ethernetboard, i downloaded also that specific library, and agin restarted the Arduino IDE, and opened the example code for Ethernet to save 1 variable. Again replaced the token and the VariableID. Compiled the code to Arduino, and i’m seeing the same error/warning message.

deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] Ubidots client(TOKEN);

Can anybody help me out? What is the problem here?

Hope to hear from anyone.

Thanks in advance.


#2

Hi @Denniske,

So I can see your problem is in the declaration of the parameters. You have to follow the same structure as the example in the documentation and you should not have any issues with our libraries.

I tested both codes and they worked well. Take a look! :slight_smile:

Regards.
Maria C.


#3

Hello Maria ,
Oke, there is a problem, but where?
I’ve installed the new IDE 1.8.1 and tested it again.
Same result with warning.
Therefore is rolled back to 1.6.12 (same IDE version as in your example)
Ans still the same result with warning.

I looked 5 times in my code, but see no differnce with yours.
Can you take a look at my code, and point me where i’m typing things wrong?

See sccreenshot (oke my IDE is in Dutch, so Bestand above the upload and verify button is File in English and so on)
Thanks a 1000 times for getting back to me.

Regards Dennis


#4

Hey @Denniske,

I tested with the last version of the Arduino IDE (1.8.0) and everything worked well, I didn’t receive any warning message.

I checked your code and we have the same code, you shouldn’t recieve any warning messages. Please, try download our library again, install it and test your code!

Regards.


#5

Hello Denniske,

The constructor receives a char* variable in the library, I suspect that there is an issue with your IDE for converting from a String to char* (which is made by the IDE itself) so please try to send your token as a char* type:

char* token = “your_token”

It’s hard to know what is going on on your certain IDE, but this declaration may help you.

PS: I attach a screencap of the compiled script without errors.

Hope it helps!


#6

I have the same problem,
jotathebest, I tried your idea, but always the same error !!


#7

thank you all, I think I found the solution:
char TOKEN[]=“12354r” ; instead of
char TOKEN=“12354r” ;