ISO C++ forbids converting a string constant to 'char*'

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
cdwille
 
Posts: 9
Joined: Thu Jul 18, 2013 11:54 am

ISO C++ forbids converting a string constant to 'char*'

Post by cdwille »

I am getting the following error on a Metro M0 Express, that had previously compiled and ran fine after the board was updated.

This seems to be connected with the text finder library, but not sure why it suddenly will not work after update.

Arduino: 1.8.13 (Mac OS X), Board: "Adafruit Metro M0 Express (SAMD21), Small (-Os) (standard), Arduino, Off"











/Users/christopherwille/Documents/Arduino/starlink_v6_8_Master/wifi_data.ino: In function 'void wifiData()':
/Users/christopherwille/Documents/Arduino/starlink_v6_8_Master/wifi_data.ino:26:19: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
26 | if(finder.find( "STARLINK" )) //find data
| ^~~~~~~~~~
/Users/christopherwille/Documents/Arduino/starlink_v6_8_Master/wifi_data.ino:35:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
35 | finder.find("STARLINK");
| ^~~~~~~~~~
/Users/christopherwille/Documents/Arduino/starlink_v6_8_Master/wifi_data.ino:42:23: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
42 | if(finder.find( "<INCLINATION>" )) //find data
| ^~~~~~~~~~~~~~~
/Users/christopherwille/Documents/Arduino/libraries/TextFinder/TextFinder.cpp: In member function 'float TextFinder::getFloat()':
/Users/christopherwille/Documents/Arduino/libraries/TextFinder/TextFinder.cpp:204:5: error: no return statement in function returning non-void [-Werror=return-type]
204 | }
| ^
cc1plus: some warnings being treated as errors
Multiple libraries were found for "Adafruit_ZeroDMA.h"
Used: /Users/christopherwille/Library/Arduino15/packages/adafruit/hardware/samd/1.7.10/libraries/Adafruit_ZeroDMA
Not used: /Users/christopherwille/Documents/Arduino/libraries/Adafruit_Zero_DMA_Library
exit status 1
Error compiling for board Adafruit Metro M0 Express (SAMD21).


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

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: ISO C++ forbids converting a string constant to 'char*'

Post by adafruit_support_bill »

Warnings are usually just warnings. C++ is getting ornery in its old age and the newer compilers will nag you about coding practices deemed dangerous. But usually they are just warnings and do not prevent things from compiling.

Further down you have an actual error. That is most likely what is causing things not to work: TextFinder.cpp:204:5: error: no return statement in function returning non-void

User avatar
cdwille
 
Posts: 9
Joined: Thu Jul 18, 2013 11:54 am

Re: ISO C++ forbids converting a string constant to 'char*'

Post by cdwille »

Thanks, that fixed it!

Locked
Please be positive and constructive with your questions and comments.

Return to “Metro, Metro Express, and Grand Central Boards”