VS2005工程由Pocket PC 2003 SDK转为WINCE6.0 SDK的问题

来源:互联网 发布:公众号矩阵推广 编辑:程序博客网 时间:2024/05/05 06:42

把VS2005工程有采用的Pocket PC 2003 SDK改为WINCE6.0 SDK,具体操作见链接

http://blog.csdn.net/loongembedded/article/details/9306225

改之后编译出错,错误信息如下:

1>Compiling...

1>UhfReader_windows.cpp

1>F:\Program Files\Microsoft VisualStudio 8\VC\ce\include\crtdefs.h(100) : fatal error C1189: #error :  ERROR: Use of C runtime library internalheader file.

1>UhfReader_common.cpp

1>F:\Program Files\Microsoft Visual Studio8\VC\ce\include\crtdefs.h(100) : fatal error C1189: #error :  ERROR: Use of C runtime library internalheader file.

1>UhfReader_API_Wince.cpp

1>F:\Program Files\Microsoft VisualStudio 8\VC\ce\include\crtdefs.h(100) : fatal error C1189: #error :  ERROR: Use of C runtime library internalheader file.

1>stdafx.cpp

1>F:\Program Files\Microsoft VisualStudio 8\VC\ce\include\crtdefs.h(100) : fatal error C1189: #error :  ERROR: Use of C runtime library internalheader file.

1>Generating Code...

“ERROR: Use of C runtime library internal header file.”是说使用了C运行库内部头文件引起了编译的错误,这个问题没有找到解决问题,但相关链接见下面:

http://bbs.csdn.net/topics/100070913

http://bbs.csdn.net/topics/350011943

 

换一种思路去解决编译的问题,打开UhfReader_API_Wince工程文件,把里面的PocketPC 2003 (ARMV4)替换为C5000W (ARMV4I)并保存,但这时候打开工程文件的时候显示的还是Pocket PC 2003 (ARMV4),如图1所示:


图1

还需要根据http://blog.csdn.net/loongembedded/article/details/9306225中的描述切换为C5000W(ARMV4I),再编译还是出错,信息如下:

1>UhfReader_windows.cpp

1>UhfReader_common.cpp

1>UhfReader_API_Wince.cpp

1>Generating Code...

1>Compiling resources...

1>Linking...

1>coredll.lib(COREDLL.dll) : fatalerror LNK1112: module machine type 'THUMB' conflicts with target machine type'ARM'

1>  Project : warning PRJ0018 : The following environmentvariables were not found:

出错的信息指模块机器(指令)类型‘THUMB’和目标平台机器(指令)类型‘ARM’冲突,选择project-> properties -> Configuration Properties -> Linker -> Command Line-> Additional options的内容做如下几种处理均可以解决此问题:

1.  把/subsystem:windowsce,4.20 /machine:ARM/ARMPADCODE替换为/subsystem:windowsce,6.00可以解决此问题。


图2

因为我们采用的操作系统是WINCE6.0,这是最好的解决办法。

 

2.  在/subsystem:windowsce,4.20 /machine:ARM/ARMPADCODE后面增加/subsystem:windowsce,5.01 /machine:THUMB

/subsystem:windowsce,6.01 /machine:THUMB

如图3所示:


图3

此版本也可以解决此问题,但这两班办法编译的logo信息却不太一样,这两种解决问题的办法在程序运行的过程中,是否有差异,还有待验证:


图4

我们先回到前面,为什么会有“module machine type 'THUMB' conflicts with target machinetype 'ARM'”这个编译错误信息,在修改之前,roject ->properties -> Configuration Properties -> Linker -> Command Line ->Additional options的内容是“/subsystem:windowsce,4.20/machine:ARM /ARMPADCODE”,有其中的windowsce,4.20可知此工程是用EVC创建的,因为V2005创建的陈工都是windowsce5.0和6.0的,我们先来看msdn中关于迁移EVC工程到VS2005的相关描述:


图5

可见EVC工程中的ARM对应于VS2005的ARMV4,而ARMV4 ->它只支持 32 ARMV4指令ARMV4T ->“T”代表 Thumb(16位指令模式)ARMV4I->“I”代表交互作用(Interworking),它允许 32 位指令和 16位指令共存 。我们的SDK是基于WINCE6.0+ARMV4I创建的,所以就需要在Additional options替换为或是增加” /subsystem:windowsce,6.00”,而且WinCE系统对指令的支持如下:
WM4.2/ppc2002/2003
支持armv4
WM5.0
支持armv4i

WINCE5.06.0支持ARMV4ARMV4I

详细信息见http://msdn.microsoft.com/en-us/library/ee482410(v=winembedded.60).aspx

所以就不存在上面编译的错误信息