While I was programming in C+=, I got a warning below during compilation. I could simply ignore the warning, but I tried to find out what caused the warning. This was because C++ compiler thinks a backslash character as line break of comment. Let’s see the warning and what causes the warning.
The warning message:
C++ compiler thinks a backslash character is line break of comment, so you can write another line of comment continuously. This comment also caused the same warning above.
The is the original comment. I was writing the C++ code on Visual Studio Code on Ubuntu. The backslash character turned to be yellow.
That was weird, but I gave it a space between the backslash and carriage return. It turned to be green as normal.
Even though, the backslash character turned to be a green font. I got the same error. So, I added a different character after the backslash. The warning was gone by adding any character other than a space or another backslash after the backslash. If I want to put a backslash character in my comment, I will do this below.
// put backslash in comment '\'
Most of programmers simply ignore warning like above, but it is better to get rid of any warning because a clean compilation message help to see error messages if a program contains errors.