編譯現象: "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。