[SOLVED]Red message while compiling

If I see this whilst compiling:

C:\Users\Harry A\AppData\Local\Temp\.arduinoIDE-unsaved20241115-30900-ob6l1n.6quj\sketch_dec15b\sketch_dec15b.ino:17:16: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
 char *CHKstr = "90.0\0";
                           ^~~~~~~~

What should I do??

Change this to:

char CHKstr[] = "90.0\0";

Make it a const char ?

There are a few details missing

  1. Sometimes this is just a warning; it depends on the configuration of the compiler which in turn depends on the board used. For AVR boards, it's just a warning, for ESP32 boards it might be an error.
  2. Your sketch (or a stripped down version that shows the message).

Note:
Why do you add the '\0'? Because the "90.0\0"; is between double quotes, it's already a nul-terrminated character array.

1 Like

@kunstmaan2024
The problem is exact the same as in your last topic:

I would recommend to you take a break in your project and read about working with char and char arrays in C/C++

2 Likes

Do what the compiler says

const char *CHKstr = "90.0";  //no need for the trailing null char, string literals get one automatically 

removing the /0 still gives a error

Post the error message.

You could also try the working example program I posted in one of your other several other cross posts on this same topic.

Flagged for moderation.

+1 for this suggestion:

I would recommend to you take a break in your project and read about working with char and char arrays in C/C++

?? am I being kickt of this forum??

Reading this may help

Thnx did not know this

I'm struggling to see the connection between a post being flagged for moderation and you being "kickt of this forum".

I assume you meant "kicked off this forum" but experience has repeatably demonstrated making assumptions to be a poor choice. I'm relying on you to correct any mistakes. A good place to start is with your own post.

The flag is for cross-posting. If that's accurate then this would be an excellent time to stop doing that. Possibly even apologize for wasting people's time.

Ah yes. This thread is painfully similar to at least one other. While you are certainly welcome to create multiple threads, you are not welcome to create multiple threads about very similar topics. Doing that delays you getting a good answer and wastes the time of those trying to help. Please do not cross-post.

youre correct, but please keep in mind that my native language is dutch ,not enlisch and I am 3/4 blind. I have to read the forum and code with a special program.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.