用Visual Studio2015 編譯時,遇到以下編譯錯誤:編碼
error C2220: warning treated as error - no 'object' file generated操作系統
warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data losscode
大概意思就是這個文件使用了non-Unicode編碼,不能正確被編譯器解析,致使編譯出錯。orm
解決方法:blog
到Windows 操做系統的Control Panel->Region 中把"Current language for non-Unicode programs:" 設置成 "English (United States)" 就能解決問題 (原來設置的是中文,編譯器會解析錯誤)。編譯器
PS: 網上其餘有一些解決方法:把文件改爲Unicode編碼(不適合我,我有幾百個文件。。。)it