WINCE CEWMPHostM例子在VS2005 WINCE5.0下編譯(轉載)

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。

 

經過以上的修改,就可以編譯這個項目文件,並且可以正確生成可執行文件。

 

本文來自CSDN博客,轉載請標明出處:http://blog.csdn.net/qinlicang/archive/2009/02/02/3858666.aspx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章