原文请见 warning C4819 解决方案 warning C4819: The file contains a character that cannot be represented in the cu

一、

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 loss

中文意思是:该文件包含不能在当前代码页中表示的字符,请将文件保存为Unicode格式,以防止数据丢失。
一般来说,这个警告没有什么影响。要想去掉这个警告的方法有:

(1)转换 Code 文件为 Unicode 格式;

(2)在Project -> Properties -> Configuration Properties -> C/C++ -> Advance(高级) 的 Disable Specific Warnings(禁用特定警告) 中添加相应的警告编号:4819;

(3)或找出不符合Unicode格式的文件,然后在该文件的开始处加入下面的语句: # pragma warning (disable:4819)

(4)哪个文件出现这个警告错误,打开它, 用VS2005的查找替换功能,打开允许正则表达式选项,选择当前窗口,查找替换 \n 为 \n , 然后,这个世界就清净了。原因:查找的 \n 是跨平台的回车,替换的 \n 却是当前代码页的回车了。

二、

编译VC++程序的时候出现如下提示警告:
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 loss

因为只是一个warning,不影响正常编译,所以并没有引起大家多大的关注。我一开始的时候也是如此。但是后来出现的次数多了,发现这个警告和在程序Debug的时候,无法停在断点,刷刷刷就过去了根本无法进行Debug。而罪魁祸首就是这个warning,改正了这个warning就能进行Debug了。

下面讲述我是怎么消除这个警告的。
这个警告的意思是:在该文件中有一个或多个字符不是Unicode字符!要求把这个字符变成Unicode字符。
难题:在编译信息里并没有提示是哪个字符,或者是在哪一行里出现的该字符。查找起来非常的难,甚至是不可能的任务!
我在网络上找了好多资料都没有找到解决方法。因为大家都不注意这个不影响编译的警告。后来在一个国外的网站上找到了解决的方法。很简单,这个方法根本不需要知道具体是哪个字符在捣鬼!

解决方法:打开出现warning的文件,Ctrl+A全选,然后在文件菜单:file->advanced save options (高级保存选项),在弹出的选项中选择新的编码方式为:UNICODE codepage 1200 ,点击确定,问题就解决了。

warning C4819 解决方案 warning C4819: The file contains a character that cannot be represented in the cu相关推荐

  1. warning C4819: The file contains a character that cannot be represented in the current code page

    warning C4819: The file contains a character that cannot be represented in the current code page 编译V ...

  2. The file contains a character that cannot be represented in the current code pag

    vs2008 打开网上下载的Qt项目,结果编译时无法通过,出现: The file contains a character that cannot be represented in the cur ...

  3. The file contains a character that cannot be represented in the current code page.c1070

    项目警告The file contains a character that cannot be represented in the current code page,同时报错c1070 mism ...

  4. THINKPHP搭建报错Warning: require(): open_basedir restriction in effect.File() is not within the allowed

    注意:当前只适用于LNMP环境 会提示 Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/wxsmal ...

  5. 关于Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file: 11043的解决办...

    Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file: /tmp/hsperfdat ...

  6. wince6.0 编译报错:error C2220: warning treated as error - no 'object' file generated的解决办法

    内容提要:wince6.0编译报错:"error C2220: warning treated as error - no 'object' file generated" 原因是 ...

  7. wince6.0 编译报错:error C2220: warning treated as error - no 'object' file generated的解决办法...

    内容提要:wince6.0编译报错:"error C2220: warning treated as error - no 'object' file generated" 原因是 ...

  8. AndroidStudio报错:Emulator: I/O warning : failed to load external entity file:/C:/Users/Administrator

    场景 在进行Android Studio的.Android Studio目录从C盘修改为其他目录后,新建App启动提示: Emulator: I/O warning : failed to load ...

  9. 【报错解决】gcc编译运行c语言程序报警告warning: no newline at end of file

    问题描述 写C语言代码,用gcc进行编译运行.出现警告. warning: no newline at end of file 解决办法 在代码的最后一行加上一个回车.就可以了.没错就是简单. 例如你 ...

最新文章

  1. Windows下有关NDK的安装资料
  2. Oracle Clustered Table
  3. Android handler
  4. 团子大家族(clannad)
  5. B-TREE、B+TREE、数据库索引
  6. 上岸 | 震惊!211高校硕士毕业后,我在非洲当酋长!
  7. pl/sql 测试函数_如何在SQL单元测试中使用伪函数?
  8. 台大李宏毅Machine Learning 2017Fall学习笔记 (7)Introduction of Deep Learning
  9. python中tile的用法_Python:numpy中的tile函数
  10. java创建hbase多个列族_Spark:DataFrame写HFile (Hbase)一个列族、一个列扩展一个列族、多个列...
  11. LeedCode知识点之位运算
  12. warning: control may reach end of non-void function [-Wreturn-type]
  13. David Pozar 微波工程读书笔记(一)
  14. 记录一次爬取淘宝/天猫评论数据的过程
  15. 三极管开关电路_利用三极管设计开关电路
  16. 利用EXCEL将中文汉字转为拼音
  17. Period 、Duration常用方法使用与介绍
  18. High Performance Visual Tracking with Siamese Region Proposal Network 阅读笔记
  19. OpenGL超级宝典笔记——光照参数与材料属性
  20. 记一次与流氓的战争——卸载360安全卫士之后

热门文章

  1. CentOs7配置java环境
  2. hive严格模式和非严格模式的区别
  3. Hadoop—SequenceFile文件的数据格式(1)
  4. 面试题 计算机安全,XX计算机信息安全工程师面试题路由.doc
  5. localhost 拒绝了我们的连接请求。_Zipkin请求链路日志聚合
  6. python属于汇编语言还是高级语言_计算机语言Python解释器
  7. im2col函数解析
  8. pandas DataFrame数据转为list
  9. Datetime 24小时制
  10. Transaction And Lock--已提交读快照