使用EMCV将工程.c文件改为.cpp文件出现错误的解决办法

编译现象:

"dm642_pci.cpp", line 183: error: argument of type "Ptr" is incompatible with parameter of type "GIO_Handle"
"dm642_pci.cpp", line 205: error: argument of type "Ptr" is incompatible with parameter of type "GIO_Handle"
"dm642_pci.cpp", line 212: error: argument of type "Ptr" is incompatible with parameter of type "GIO_Handle"
"dm642_pci.cpp", line 213: error: argument of type "Ptr" is incompatible with parameter of type "GIO_Handle"
 
4 errors detected in the compilation of "dm642_pci.cpp".
 
>> Compilation failure
 
Compile Complete,
4 Errors, 0 Warnings, 0 Remarks.
 
分析原因:
上述错误都是提示类型不匹配,产生原因是C++编译器对类型的检测更加严格。在C语言中void*指针可以方便的和其他指针转换,但在C++中需要手工强制转换。
 
解决办法:
在Ptr指针定义的变量g_pMyGio处加上强制类型转换,即(GIO_Handle)g_pMyGio。
永不止步步 发表于11-07 09:40 浏览65535次
分享到:

已有0条评论

暂时还没有回复哟,快来抢沙发吧

添加一条新评论

只有登录用户才能评论,请先登录注册哦!

话题作者

永不止步步
金币:67410个|学分:307967个
立即注册
畅学电子网,带你进入电子开发学习世界
专业电子工程技术学习交流社区,加入畅学一起充电加油吧!

x

畅学电子网订阅号