您的位置:首页 > 其它

转载一些wince常见错误及解决办法

2014-07-01 23:38 316 查看

Wince6.0SDK问题

最近要做Wince6.0下的数据库的东西,用VS2005装了WINCE6_CHS_SDK,但是建立智能设备的MFC工程以后就无法调试,报错如下。。。
1>C:\Program Files\Windows CE Tools\wce600\CHSINT SDK For WinCE 6.0\include\ARMV4I\malloc.h(45) : error C2143: syntax error : missing ',' before '*'
1>C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlosapice.h(879) : warning C4996: 'wcsncpy' was declared deprecated
1>        c:\program files\windows ce tools\wce600\chsint sdk for wince 6.0\include\armv4i\stdlib.h(177) : see declaration of 'wcsncpy'
1>        Message: 'This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlosapice.h(1075) : warning C4996: 'wcsncpy' was declared deprecated
1>        c:\program files\windows ce tools\wce600\chsint sdk for wince 6.0\include\armv4i\stdlib.h(177) : see declaration of 'wcsncpy'
1>        Message: 'This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlosapice.h(1123) : warning C4996: 'wcsncpy' was declared deprecated
1>        c:\program files\windows ce tools\wce600\chsint sdk for wince 6.0\include\armv4i\stdlib.h(177) : see declaration of 'wcsncpy'
1>        Message: 'This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atltime.h(402) : error C3861: 'wcsftime': identifier not found
1>C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atltime.h(429) : error C3861: 'wcsftime': identifier not found
1>C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlcomtime.h(367) : error C3861: 'wcsftime': identifier not found
搞的我很郁闷啊。。。完全不知道怎么回事。。。
1.在项目的stdafx.h中寻找#pragma once语句,在它的后面加入如下所示的宏定义 : #define _CRT_SECURE_NO_DEPRECATE2.在项目的stdafx.h中寻找#pragma once语句,在它的后面加入如下所示的编译控制语句 : #pragma warning(disable:4996)

Windows Mobile移植到WinCE碰到的问题  

1)注释“#define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA”2)CreateMenuBar、AtlCreateMenuBar 无法使用,需使用SHCreateMenuBarHWND CCWSmartClientDialog::CreateCECommandBar( HWND hWnd ){SHMENUBARINFO mbi;memset(&mbi, 0, sizeof(SHMENUBARINFO));mbi.cbSize     = sizeof(SHMENUBARINFO);mbi.hwndParent = hWnd;mbi.nToolBarId = ID_TOOLBAR1;mbi.hInstRes   = _Module.GetModuleInstance();mbi.nBmpId     = 0;mbi.cBmpImages = 0;if (!SHCreateMenuBar(&mbi)) return NULL;return mbi.hwndMB;}3)LoadImage函数装载图标无效。实例句柄得用_tWinMain传递过来的,不用使用_Module.GetModuleInstance来获取,这两者得到的实例句柄不一样,原因我还没弄明白。尝试解决办法:1)我怀疑是因为我改了atlapp.h中关于RegisterClassObjects部分导致的,但将另外一个RegisterClassObjects定义屏蔽掉结果也是一样的,估计跟这个没有关系。2)我跟踪了CComModule::m_hInst产生过程,但在CComModule::Init过程就跟不下去了,不知道ATL是怎么传递WinMain的hInstance到CAtlBaseModule类去的。3)临时解决办法:在-tWinMain函数中,_Module.AppRun之前,将hInstance赋值给CComModule的资源句柄,这样在程序其它地方就可以将它当作实例句柄了。  _Module.SetResourceInstance(hInstance);4)COM模块编译时会报错,提示UpdateRegistry不是xx的成员:1>d:\日程\today\wince projects\atltest\ATLCls.h(65) : error C2039: “UpdateRegistry”: 不是“CATLCls”的成员1>        d:\日程\today\wince projects\atltest\ATLCls.h(28) : 参见“CATLCls”的声明1>d:\日程\today\wince projects\atltest\ATLCls.h(65) : error C2065: “UpdateRegistry”: 未声明的标识符解决办法:   在COM类的头文件中找到#ifndef _CE_DCOM语句,  #ifndef _CE_DCOMDECLARE_REGISTRY_RESOURCEID(IDR_xxxxx)#endif  改为  #ifdef _CE_DCOM //由#ifndef->#ifdefDECLARE_REGISTRY_RESOURCEID(IDR_xxxxx)#endif5)RegisterClassObjects和RevokeClassObjects重定义1>C:\WTL81\Include\atlapp.h(154) : error C2084: 函数“HRESULT ATL::CComModule::RegisterClassObjects(DWORD,DWORD) throw()”已有主体1>        F:\Xp ProgramFiles\Microsoft Visual Studio 9.0\VC\ce\atlmfc\include\atlbase.h(4471) : 参见“RegisterClassObjects”的前一个定义1>C:\WTL81\Include\atlapp.h(156) : error C2084: 函数“HRESULT ATL::CComModule::RevokeClassObjects(void) throw()”已有主体1>        F:\Xp ProgramFiles\Microsoft Visual Studio 9.0\VC\ce\atlmfc\include\atlbase.h(4472) : 参见“RevokeClassObjects”的前一个定义解决办法:修改atlapp.h,找到下列语句:namespace ATL{  inline HRESULT CComModule::RegisterClassObjects(DWORD /*dwClsContext*/, DWORD /*dwFlags*/) throw()  { return E_NOTIMPL; }  inline HRESULT CComModule::RevokeClassObjects() throw()  { return E_NOTIMPL; }}; // namespace ATL加上宏开关#ifndef _WIN32_WCE namespace ATL{  inline HRESULT CComModule::RegisterClassObjects(DWORD /*dwClsContext*/, DWORD /*dwFlags*/) throw()  { return E_NOTIMPL; }  inline HRESULT CComModule::RevokeClassObjects() throw()  { return E_NOTIMPL; }}; // namespace ATL#endif
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐