Reputation: 275
I'm new to C++ and my code is giving me the following error when I try to build the project:
Severity Code Description Project File Line Suppression State Error C3872 '0x2019': this character is not allowed in an identifier
I am using Visual Studio 2019 Professional. I am running my code in Release and in my properties I am using MFC in a static Library. Before running the code doesn't display an errors. The lines causing the errors:
CString customer’sTelephoneNumber;
CString customer’sAddress;
Upvotes: 0
Views: 1532
Reputation: 51874
You cannot use the ’
character (or, indeed, any punctuation marks) in the name of a variable in C++. You can only use Latin letters (upper or lower case), decimal digits ('0' thru '9'), the underscore (_
) character and some Unicode characters (as detailed in the reference linked below). The first character in the name cannot be a digit, and names that begin with an underscore are best avoided, as they are often used internally by compiler implementations.
The C++ Standard is quite verbose and difficult to quote, on this matter, but there is a fairly good summary on this cppreference page.
Upvotes: 2