Error RC2135 in C++ project due to UTF-8 encoding of RC file

RenniePet picture RenniePet · Mar 6, 2013 · Viewed 13.3k times · Source

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

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.

Answer

RenniePet picture RenniePet · Mar 6, 2013

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

So the solution is to re-encode the .rc file as ANSI or UTF-16.