问题
While compiling some code I receive the following:
"error C2018: unknown character '0x40'"
I wonder how to resolve such issue?
回答1:
Here is where I would begin:
Have you included any non-standard include files? If so, check those for errors.
Have you missed a semi-colon somewhere?
Have you accidently used object > data instead of object -> data anywhere in your code?
Have you copied the code from one machine (OS) to another, causing encoding issues?
回答2:
Character 0x40 is '@' in ascii, iso-8859-1, utf-8 and many other encodings. It's also not part of the basic character set in C so should not appear in your source except possibly in a character or string literal or a comment. How are you using it and what are you trying to do?
回答3:
I've just got this error, but complaining about character '0x6', compiling a CPP file with Visual Studio 2010. And I got rid of it rewriting the line that was causing the error (writing the very same line above the old one, and deleting the old one).
回答4:
Open offending .c file in hex editor and search for 0x40. Maybe some unicode or utf8 string made it into ascii file.
回答5:
The problem was simply in NOT including the header that contains #define MYSQL_VERSION_ID which was referred in offended code.
回答6:
I had this error with a TeamCity build. I had a VS2013 generated resource file which was causing the error. I found that the encoding was odd, which I could see in NotePad++. So I converted the encoding to UTF-8 without BOM in NotePad++, which fixed my problem.
回答7:
My code was previously edited in XCode, and needed to be built in Visual Studio. In Visual Studio I found files with "._filename" but didn't see them in the explorer. Delete these and it should build!
来源:https://stackoverflow.com/questions/1169670/how-to-interpret-error-c2018-unknown-character-0x40