I have seen questions about the Visual Studio error “fatal error LNK1112: module machine type 'THUMB' conflicts with target machine type 'ARM'” quite a bit lately. Tonight it happened to me.
I was working on a project that I had targeded against the PocketPC 2003 SDK. Then I added a new SDK, in this case a Windows CE 5.0 ARMV4I SDK, to the project and had it copy settings from the PocketPC 2003 settings. Unfortunatly, not copying the settings makes things worse. Adding the SDK looks like:
The problem results from combining settings from the original SDK with the new SDK, by copying the settings. The original SDK for PocketPC 2003 was set for ARMV4, which means ARM only instructions.  The newly added SDK is set for ARMV4I, which means interworking between ARM and THUMB instructions. The difference looks small, but it is big. ARM is 32 bit instructions and THUMB is 16 bit instructions.
This problem is cause by the settings in the PocketPC 2003 SDK which includes some additional linker options.
The following is how I fixed it, or corrected the project properties.
1.       Open the Project Properties window (in the menu, Project\<Project Name> Properties)
2.       Go to Configuration Properties\Linker\Command Line, which looks like:
 
           The problem is the Additional Options “/subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE” which are inconsistent with the compiler settings for the project and the libraries in the SDK.
4.       Change the Additional Options to “/subsystem:windowsce /ARMPADCODE”
5.       Rebuild the project
 
Copyright © 2009 – Bruce Eitman
All Rights Reserved