[VS compilation error] Error C2220: Warning is considered an error - no "object" file is generated (personal test and easy-to-use version)

VS compilation error: Error C2220: Warning is considered an error - no "object" file was generated

Reason : The encoding format used by this file is different from the code page format corresponding to the current system. chcpEnter the command in the cmd window , and you can see that the active code page of the current system is Chinese gb2312-936, and the code page of the original file is unicode or utf-8.

Solution 1 : Open the .cpp file in Notepad, then save it as, select another appropriate encoding, and then save it. Encoding changed from UTF-8 or ANSI to Unicode or UTF-8 with BOM.
Insert image description here

Solution 2 : Set the project properties and cancel the warning as an error.
Project - Properties - Configuration Properties - C/C++ - General - Treat warnings as errors, change it to No, and recompile.

Reference articles : Handling Chinese garbled characters in C programs (five methods) ,
Visual C++ compilation error: error C2220: Warning is considered an error - no "object" file is generated ,
error C2220: Warning is considered an error - no "object" is generated document

Guess you like

Origin blog.csdn.net/m0_51141265/article/details/133135900