由于RC文件的UTF-8编码,C ++项目中出现错误RC2135 [英] Error RC2135 in C++ project due to UTF-8 encoding of RC file
问题描述
从Visual Studio 2010切换到2012年后,我遇到了10个RC2135错误,这些错误在我的一个C ++项目中看起来很奇怪.
After switching from Visual Studio 2010 to 2012 I got 10 RC2135 errors that looked rather strange in one of my C++ projects.
Error 1 error RC2135: file not found: 0x06 NamedPipesNative.rc 19 1 NamedPipesNative
Error 2 error RC2135: file not found: 1 NamedPipesNative.rc 28 1 NamedPipesNative
Error 3 error RC2135: file not found: 5 NamedPipesNative.rc 29 1 NamedPipesNative
Error 4 error RC2135: file not found: 5 NamedPipesNative.rc 30 1 NamedPipesNative
Error 5 error RC2135: file not found: 0x17L NamedPipesNative.rc 31 1 NamedPipesNative
Error 6 error RC2135: file not found: FILEOS NamedPipesNative.rc 37 1 NamedPipesNative
Error 7 error RC2135: file not found: 0x2L NamedPipesNative.rc 38 1 NamedPipesNative
Error 8 error RC2164: unexpected value in RCDATA NamedPipesNative.rc 41 1 NamedPipesNative
Error 9 error RC2135: file not found: BLOCK NamedPipesNative.rc 43 1 NamedPipesNative
Error 10 error RC2135: file not found: VALUE NamedPipesNative.rc 45 1 NamedPipesNative
不幸的是,我认为这与切换到VS 2012有关(它询问我是否要转换C ++项目),并且我花了很多时间试图根据这个假设来解决它.但是实际上这是完全不同的东西.为了帮助遇到此问题的其他人,我会在稍后发布答案.
Unfortunately I assumed this had something to do with the switch to VS 2012 (it had asked if I wanted to convert the C++ project or not), and I spent a lot of time trying to figure it out based on that assumption. But in fact it was something completely different. In the hopes of helping anyone else who runs into this problem I'll post the answer in a moment.
推荐答案
作为切换到Visual Studio 2012的一部分,我还使用处理了我所有内容的自制程序更新了.rc文件中的程序版本号. AssemblyInfo.cs和.rc文件,并且它已将.rc文件的编码从ANSI更改为UTF-8.而且Microsoft Resource Compiler无法正确读取UTF-8文件! http://social.msdn .microsoft.com/Forums/hu-HU/vcgeneral/thread/e212069d-678e-4ac8-957f-7d60d3e1c89f
As part of the switch to Visual Studio 2012 I had also updated the program version number in the .rc file using a home-made program that processed all of my AssemblyInfo.cs and .rc files, and it had changed the encoding of the .rc file from ANSI to UTF-8. And the Microsoft Resource Compiler can't read UTF-8 files properly! http://social.msdn.microsoft.com/Forums/hu-HU/vcgeneral/thread/e212069d-678e-4ac8-957f-7d60d3e1c89f
因此解决方案是将.rc文件重新编码为ANSI或UTF-16.
So the solution is to re-encode the .rc file as ANSI or UTF-16.
这篇关于由于RC文件的UTF-8编码,C ++项目中出现错误RC2135的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!