使用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。

你可能感兴趣的:(使用EMCV将工程.c文件改为.cpp文件所出现错误的解决办法)