The dash before the number three is a Unicode character that looks like a dash. Delete it, and insert a new dash and you'll be fine.
If you used copy-paste, then beware, as pasted code can contain Unicode characters and that may lead to compilation errors like this.
If you typed it manually into an editor, use a different editor or alter the settings of the editor not to convert standard hyphens into other characters. E.g., Microsoft Word does this conversion, but I hope that you did not write code in Word.
The explanation of the error message:
You saved the file in UTF-8 charset. The altered hyphen you used is saved as three consecutive bytes: 0xE2 0x80 0x93
(hexadecimal values)
g++ parses the file byte by byte. It encounters 0xE2
first, which it considers invalid and outputs error: stray '\342' in program
. The 342
is the octal representation of 0xE2
. And \342
is valid C++ code, it is the escaped version of 0xE2 character. See C++ escape sequences for details, \nnn
means the character represented by the octal nnn
number.