AWSW-de / WordClock-16x8-LED-matrix

WordClock 16x16 LED matrix (2023)
GNU General Public License v3.0
22 stars 8 forks source link

Compilation error: 'sprintf' writing a terminating nul past the end of the destination [-Werror=format-overflow=] #6

Closed misc2012-DE closed 11 months ago

misc2012-DE commented 11 months ago

Thanks for this great Development, good work. Hope you can help regarding this problem, compiling is not possible on windows with the newest Arduino iDE. (2.2.1) I did everything you stated in your video. The following errors occur in the terminal window:

Do you have a easy solution for this ?

Thanks Michael

G:\Downloads\Code\Code.ino: In function 'void setupWebInterface()': G:\Downloads\Code\Code.ino:302:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 0) selectLang = "German"; ^~~~ G:\Downloads\Code\Code.ino:303:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 1) selectLang = "English"; ^~~~~ G:\Downloads\Code\Code.ino:304:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 2) selectLang = "Dutch"; ^~~ G:\Downloads\Code\Code.ino:305:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 3) selectLang = "Swedish"; ^~~~~ G:\Downloads\Code\Code.ino:306:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 4) selectLang = "Italian"; ^~~~~ G:\Downloads\Code\Code.ino:307:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 5) selectLang = "French"; ^~~~ G:\Downloads\Code\Code.ino:308:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 6) selectLang = "Swiss German"; ^~~~~~ G:\Downloads\Code\Code.ino:309:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 7) selectLang = "Chinese"; ^~~~~ G:\Downloads\Code\Code.ino:310:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 8) selectLang = "Swabian German"; ^~~~ G:\Downloads\Code\Code.ino:311:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 9) selectLang = "Bavarian"; ^~~~~~ G:\Downloads\Code\Code.ino: In function 'void call_langauge_select(Control, int)': G:\Downloads\Code\Code.ino:491:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 0) selectLang = "German"; ^~~~ G:\Downloads\Code\Code.ino:492:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 1) selectLang = "English"; ^~~~~ G:\Downloads\Code\Code.ino:493:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 2) selectLang = "Dutch"; ^~~ G:\Downloads\Code\Code.ino:494:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 3) selectLang = "Swedish"; ^~~~~ G:\Downloads\Code\Code.ino:495:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 4) selectLang = "Italian"; ^~~~~ G:\Downloads\Code\Code.ino:496:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 5) selectLang = "French"; ^~~~ G:\Downloads\Code\Code.ino:497:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 6) selectLang = "Swiss German"; ^~~~~~ G:\Downloads\Code\Code.ino:498:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 7) selectLang = "Chinese"; ^~~~~ G:\Downloads\Code\Code.ino:499:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] if (langLEDlayout == 8) selectLang = "Swabian German"; ^~~~ G:\Downloads\Code\Code.ino:500:40: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] if (langLEDlayout == 9) selectLang = "Bavarian"; ^~~~~~ G:\Downloads\Code\Code.ino: In function 'void setTime(int, int, int, int, int, int, int)': G:\Downloads\Code\Code.ino:3867:38: warning: missing initializer for member 'timeval::tv_usec' [-Wmissing-field-initializers] struct timeval now = { .tv_sec = t }; ^ G:\Downloads\Code\Code.ino: In function 'void setupWebInterface()': G:\Downloads\Code\Code.ino:169:21: error: 'sprintf' writing a terminating nul past the end of the destination [-Werror=format-overflow=] sprintf(hex_time, "#%02X%02X%02X", redVal_time, greenVal_time, blueVal_time); ^~~~~~~ G:\Downloads\Code\Code.ino:169:10: note: 'sprintf' output between 8 and 26 bytes into a destination of size 7 sprintf(hex_time, "#%02X%02X%02X", redVal_time, greenVal_time, blueVal_time);


G:\Downloads\Code\Code.ino:175:21: error: 'sprintf' writing a terminating nul past the end of the destination [-Werror=format-overflow=]
   sprintf(hex_back, "#%02X%02X%02X", redVal_back, greenVal_back, blueVal_back);
                     ^~~~~~~~~~~~~~~
G:\Downloads\Code\Code.ino:175:10: note: 'sprintf' output between 8 and 26 bytes into a destination of size 7
   sprintf(hex_back, "#%02X%02X%02X", redVal_back, greenVal_back, blueVal_back);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus.exe: some warnings being treated as errors

exit status 1

Compilation error: 'sprintf' writing a terminating nul past the end of the destination [-Werror=format-overflow=]
AWSW-de commented 11 months ago

Hi, try to turn off the verbose output in the Arduino settings. Kind regards

misc2012-DE commented 11 months ago

Hi, i tried already got the same problem, compilation error. Now i used my Macbook and everything went fine, Thank you!

AWSW-de commented 11 months ago

Hi, strange but nice you got it working. Have much fun with it. =)