3503|1

64

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

从VC6.0 到EVC报错.请高手指点 [复制链接]

-------------------Configuration: MySqurt - Win32 (WCE emulator) Debug--------------------
Compiling...
MySqurt.cpp
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(104) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'int (void *)' to 'unsigned long (__cdecl *)(void *)'
        None of the functions with this name in scope match the target type
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(266) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'int (void *)' to 'unsigned long (__cdecl *)(void *)'
        None of the functions with this name in scope match the target type
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(287) : error C2664: 'recv' : cannot convert parameter 2 from 'unsigned char *' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(295) : error C2664: 'recv' : cannot convert parameter 2 from 'unsigned char *' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(313) : error C2440: '=' : cannot convert from 'void *' to 'unsigned char *'
        Conversion from 'void*' to pointer to non-'void' requires an explicit cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(315) : error C2664: 'ReadFile' : cannot convert parameter 4 from 'int *' to 'unsigned long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(324) : error C2664: 'send' : cannot convert parameter 2 from 'unsigned char *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(329) : error C2664: 'recv' : cannot convert parameter 2 from 'unsigned char *' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(336) : error C2664: 'send' : cannot convert parameter 2 from 'unsigned char *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(346) : error C2664: 'recv' : cannot convert parameter 2 from 'unsigned char *' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(350) : error C2664: 'send' : cannot convert parameter 2 from 'unsigned char *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(420) : error C2664: 'send' : cannot convert parameter 2 from 'unsigned char *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(423) : error C2664: 'send' : cannot convert parameter 2 from 'unsigned char *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(425) : error C2440: '=' : cannot convert from 'void *' to 'unsigned char *'
        Conversion from 'void*' to pointer to non-'void' requires an explicit cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(427) : error C2664: 'recv' : cannot convert parameter 2 from 'unsigned char *' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(462) : error C2664: 'send' : cannot convert parameter 2 from 'unsigned char *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(470) : error C2664: 'recv' : cannot convert parameter 2 from 'unsigned char *' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(481) : error C2664: 'WriteFile' : cannot convert parameter 4 from 'int *' to 'unsigned long *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\WORKING\WIN CE\MySqurt\MySqurt.cpp(487) : error C2664: 'send' : cannot convert parameter 2 from 'unsigned char *' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

MySqurt.exe - 19 error(s), 0 warning(s)

最新回复

有两类问题, 1.因为VC6.0默认的编译选项是MBCS,所以你的程序是在非UNICODE环境下编译的。而EVC要求必须使用UNICODE环境,所有字符串都要使用TCHAR或者WCHAR,如果你的字符串是CHAR的,带入EVC中的UNICODE 版本的API,就会出错 2.另一类错误是一些API的定义与VC有点差异,有的你强制转换一下就好。 你可以这样调试,想把VC6程序改成UNICODE版本(去掉MBCS,加上_UNICODE,UNICODE),如果编译通过了再移植。  详情 回复 发表于 2007-6-29 17:13
点赞 关注

回复
举报

70

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
有两类问题,

1.因为VC6.0默认的编译选项是MBCS,所以你的程序是在非UNICODE环境下编译的。而EVC要求必须使用UNICODE环境,所有字符串都要使用TCHAR或者WCHAR,如果你的字符串是CHAR的,带入EVC中的UNICODE 版本的API,就会出错

2.另一类错误是一些API的定义与VC有点差异,有的你强制转换一下就好。

你可以这样调试,想把VC6程序改成UNICODE版本(去掉MBCS,加上_UNICODE,UNICODE),如果编译通过了再移植。
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表