主题:编译通不过

  共有33392人关注过本帖    
客人
1楼


编译通不过  发帖心情 Post By:2013-3-22 10:34:00   [只看该作者]

VS2008编译老是通不过啊,请各位帮助一下,
1>C:\Program Files\Windows CE Tools\wce600\EM9170\include\ARMV4I\shellapi.h(321) : error C2061: syntax error : identifier 'SHFILEINFOW'
1>D:\Program Files\Microsoft Visual Studio 9.0\VC\ce\atlmfc\include\afxv_w32.h(232) : fatal error C1083: Cannot open include file: 'mbctype.h': No such file or directory

在MFC下调试成功的一个类(实现一个仪表),搬到智能设备下的MFC应用程序编译就通不过了,咋回事呢?

  单帖管理 | 引用 | 回复 回到顶部
帅哥哟,离线,有人找我吗?
yy
2楼 信息 | 搜索 | 邮箱


加好友 发短信
  发帖心情 Post By:2013-3-22 11:40:00   [只看该作者]

SHFILEINFOW没定义,这个结构体在shellapi.h里定义的,根据你是否定义了UNICODE决定到底是该使用SHFILEINFOA还是SHFILEINFOW。
mbctype.h这个头文件CE没有,CE只有ctype.h。

WINCE比windows精简的很多,其中WINCE只支持UNICODE,所以移植的时候ANSI的都要改成UNICODE的,就是char的都要改成WCHAR的,char字符串和WCHAR字符串可以用mbstowcs和wcstombs来转。你两个问题都是这个原因。

  单帖管理 | 引用 | 回复 回到顶部
客人
3楼


能说的详细点吗  发帖心情 Post By:2013-3-22 12:24:00   [只看该作者]

你好谢谢你解答,我把编译模式改成UNICODE后,原来的错误确实没有了,但是心的错误马上又来了,一下增加到20几条,哎,wince下移植看来需要改动的地方很多啊,我想用你们的硬件开发产品,软件这一块受局限太大了,以前主要做硬件,请多多帮助,谢谢
1>正在编译...
1>stdafx.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>D:\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\em9170\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>D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlosapice.h(893) : warning C4996: '_vsnwprintf' was declared deprecated
1>        c:\program files\windows ce tools\wce600\em9170\include\armv4i\stdlib.h(382) : see declaration of '_vsnwprintf'
1>        Message: 'This function or variable may be unsafe. Consider using _vsnwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlosapice.h(910) : warning C4996: '_vsnprintf' was declared deprecated
1>        c:\program files\windows ce tools\wce600\em9170\include\armv4i\stdlib.h(377) : see declaration of '_vsnprintf'
1>        Message: 'This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>D:\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\em9170\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>D:\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\em9170\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>D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlchecked.h(157) : warning C4996: '_strlwr' was declared deprecated
1>        C:\Program Files\Windows CE Tools\wce600\EM9170\include\ARMV4I\stdlib.h(240) : see declaration of '_strlwr'
1>        Message: 'This function or variable may be unsafe. Consider using _strlwr_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlchecked.h(167) : warning C4996: '_wcslwr' was declared deprecated
1>        C:\Program Files\Windows CE Tools\wce600\EM9170\include\ARMV4I\stdlib.h(189) : see declaration of '_wcslwr'
1>        Message: 'This function or variable may be unsafe. Consider using _wcslwr_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlchecked.h(192) : warning C4996: '_wcslwr' was declared deprecated
1>        C:\Program Files\Windows CE Tools\wce600\EM9170\include\ARMV4I\stdlib.h(189) : see declaration of '_wcslwr'
1>        Message: 'This function or variable may be unsafe. Consider using _wcslwr_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlchecked.h(209) : warning C4996: '_wcsupr' was declared deprecated
1>        C:\Program Files\Windows CE Tools\wce600\EM9170\include\ARMV4I\stdlib.h(190) : see declaration of '_wcsupr'
1>        Message: 'This function or variable may be unsafe. Consider using _wcsupr_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlchecked.h(226) : warning C4996: '_wcsupr' was declared deprecated
1>        C:\Program Files\Windows CE Tools\wce600\EM9170\include\ARMV4I\stdlib.h(190) : see declaration of '_wcsupr'
1>        Message: 'This function or variable may be unsafe. Consider using _wcsupr_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\atlchecked.h(291) : warning C4996: '_gcvt' was declared deprecated
1>        C:\Program Files\Windows CE Tools\wce600\EM9170\include\ARMV4I\stdlib.h(529) : see declaration of '_gcvt'
1>        Message: 'This function or variable may be unsafe. Consider using _gcvt_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>正在编译...
1>deemo.cpp
1>deemoDlg.cpp
1>Meter.cpp
1>d:\我的文档\visual studio 2005\projects\deemo\deemo\MemDC.h(81) : error C3861: 'SetMapMode': identifier not found
1>d:\我的文档\visual studio 2005\projects\deemo\deemo\MemDC.h(83) : error C3861: 'SetWindowOrg': identifier not found
1>.\Meter.cpp(177) : error C2039: 'Arc' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(192) : error C2039: 'Arc' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(254) : error C2039: 'CreatePolygonRgn' : is not a member of 'CRgn'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(501) : see declaration of 'CRgn'
1>.\Meter.cpp(254) : error C2065: 'ALTERNATE' : undeclared identifier
1>.\Meter.cpp(280) : error C2664: 'CFont::CreateFont' : cannot convert parameter 14 from 'const char [6]' to 'LPCTSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\Meter.cpp(287) : error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [6]' to 'const wchar_t *'
1>        with
1>        [
1>            BaseType=wchar_t,
1>            StringTraits=StrTraitMFC<wchar_t>
1>        ]
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\Meter.cpp(292) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(298) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(303) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(308) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(314) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(319) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(324) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(329) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(334) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(512) : error C2039: 'Arc' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(534) : error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [6]' to 'const wchar_t *'
1>        with
1>        [
1>            BaseType=wchar_t,
1>            StringTraits=StrTraitMFC<wchar_t>
1>        ]
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\Meter.cpp(541) : error C2664: 'CFont::CreateFont' : cannot convert parameter 14 from 'const char [6]' to 'LPCTSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\Meter.cpp(545) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>.\Meter.cpp(546) : error C2039: 'TextOut' : is not a member of 'CDC'
1>        D:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include\afxwin.h(546) : see declaration of 'CDC'
1>Generating Code...
1>生成日志保存在“file://d:\我的文档\Visual Studio 2005\Projects\deemo\deemo\EM9170 (ARMV4I)\Debug\BuildLog.htm”
1>deemo - 22 个错误,11 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========


  单帖管理 | 引用 | 回复 回到顶部
帅哥哟,离线,有人找我吗?
yy
4楼 信息 | 搜索 | 邮箱


加好友 发短信
  发帖心情 Post By:2013-3-22 14:12:00   [只看该作者]

把windows上的程序移植到CE上确实不是改改配置就可以的,要改的地方很多的,大部分原因是CE精简了一些重复封装的库函数还有就是UNICODE的问题。被精简掉的库函数可以用其他函数代替,UNICODE的问题一般错误很多,但是并不难改。

你前面很多宽字符串处理函数的错误应该是你的参数没弄对,printf("test");对应wprintf(L"test");    int len = strlen("test");对应int len = wcslen(L"test");宽字符串要记得加L
后面GDI里面TextOut这个函数CE是没有的,这个函数就是把DrawText封装了下,你自己用DrawText重新实现下吧。
const char [6]' to 'LPCTSTR这个错误就是你吧一个窄字符数组直接当宽字符串指针传了,你要先用mbstowcs转一下,或者你干脆把你整个工程的所有字符串都改成宽字符的。


  单帖管理 | 引用 | 回复 回到顶部

返回首页

编译通不过

用户名:
            验证码: 验证码,看不清楚?请点击刷新验证码
内容: