1,使用VS2005 自带的转换工具把它转为vs2005下的工程。
如果这样马上编译会得到如下的错误:
Rebuild All started: Project: SPWmpHost, Configuration: Debug Pocket PC 2003 (ARMV4) ------
1>Deleting intermediate and output files for project 'SPWmpHost', configuration 'Debug|Pocket PC 2003 (ARMV4)'
1>Compiling...
1>wmphost.cpp
1>_CE_ACTIVEX was not defined because this Windows CE SDK does not have DCOM.
1> _CE_ACTIVEX could be caused to be defined by defining _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA, but it is recommended that this be done only for single-threaded apps.
1>_ATL_NO_HOSTING was defined because _CE_ACTIVEX was not defined.
1>WINVER was defined to be 0x0400, as it was either not set or set to a lower value
1>D:/Program Files/Microsoft Visual Studio 8/VC/ce/atlmfc/include/atlhost.h(43) : fatal error C1189: #error : atlhost.h requires Hosting support (_ATL_NO_HOSTING is defined). For Windows CE platforms without DCOM support, _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA needs to be defined.
1>WMPGuids.cpp
1>PopDlgs.cpp
1>_CE_ACTIVEX was not defined because this Windows CE SDK does not have DCOM.
1> _CE_ACTIVEX could be caused to be defined by defining _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA, but it is recommended that this be done only for single-threaded apps.
1>_ATL_NO_HOSTING was defined because _CE_ACTIVEX was not defined.
1>WINVER was defined to be 0x0400, as it was either not set or set to a lower value
1>D:/Program Files/Microsoft Visual Studio 8/VC/ce/atlmfc/include/atlhost.h(43) : fatal error C1189: #error : atlhost.h requires Hosting support (_ATL_NO_HOSTING is defined). For Windows CE platforms without DCOM support, _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA needs to be defined.
1>MediaLibraryDlg.cpp
1>_CE_ACTIVEX was not defined because this Windows CE SDK does not have DCOM.
1> _CE_ACTIVEX could be caused to be defined by defining _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA, but it is recommended that this be done only for single-threaded apps.
1>_ATL_NO_HOSTING was defined because _CE_ACTIVEX was not defined.
1>WINVER was defined to be 0x0400, as it was either not set or set to a lower value
1>D:/Program Files/Microsoft Visual Studio 8/VC/ce/atlmfc/include/atlhost.h(43) : fatal error C1189: #error : atlhost.h requires Hosting support (_ATL_NO_HOSTING is defined). For Windows CE platforms without DCOM support, _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA needs to be defined.
1>CWMPHost.cpp
1>_CE_ACTIVEX was not defined because this Windows CE SDK does not have DCOM.
1> _CE_ACTIVEX could be caused to be defined by defining _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA, but it is recommended that this be done only for single-threaded apps.
1>_ATL_NO_HOSTING was defined because _CE_ACTIVEX was not defined.
1>WINVER was defined to be 0x0400, as it was either not set or set to a lower value
1>D:/Program Files/Microsoft Visual Studio 8/VC/ce/atlmfc/include/atlhost.h(43) : fatal error C1189: #error : atlhost.h requires Hosting support (_ATL_NO_HOSTING is defined). For Windows CE platforms without DCOM support, _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA needs to be defined.
1>CWMPEventDispatch.cpp
1>_CE_ACTIVEX was not defined because this Windows CE SDK does not have DCOM.
1> _CE_ACTIVEX could be caused to be defined by defining _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA, but it is recommended that this be done only for single-threaded apps.
1>_ATL_NO_HOSTING was defined because _CE_ACTIVEX was not defined.
1>WINVER was defined to be 0x0400, as it was either not set or set to a lower value
1>D:/Program Files/Microsoft Visual Studio 8/VC/ce/atlmfc/include/atlhost.h(43) : fatal error C1189: #error : atlhost.h requires Hosting support (_ATL_NO_HOSTING is defined). For Windows CE platforms without DCOM support, _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA needs to be defined.
1>Generating Code...
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 8.00.50727
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>BSCMAKE: error BK1506 : cannot open file './Pocket PC 2003 (ARMV4)/Debug/CWMPEventDispatch.sbr': No such file or directory
1>Build log was saved at "file://d:/wince/wmpmobilesamples/CEWMPHostML/Pocket PC 2003 (ARMV4)/Debug/BuildLog.htm"
其实就是_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA 没有在编译选项定义,这样需要修改工程的设置:
具体修改如下:
1。在GENERAL选项卡的USE OF ATL一项,在下拉菜单中选择“Static Link to ATL”一项。

2.设置wmsdk的路径

3。增加预编译选项。

4,去掉不必要的链接库,atlce400.lib。

经过以上的修改,就可以编译这个项目文件,并且可以正确生成可执行文件。
本文解决了一个在VS2005中编译特定项目遇到的问题,主要是因为缺少必要的编译选项导致的错误。通过修改项目的编译设置,包括使用静态链接到ATL、设置wmsdk路径、增加预编译选项并移除不必要的链接库,成功解决了编译错误。
4271





