qt6.5内,使用函数传递参数类型不匹配
一下是结构体定义
typedef struct getprinterinfo_usbPrinterStateParms_S {
unsigned char isMFP; //If it is MFP, then will be 1, else it is 0 means SFP,
unsigned char isMono; //If it is a Mono printer, then will be 1, else it is 0 means Color printer
unsigned char supportNetwork; //If support Network, then it will be 1, else it is 0 means Not-Support or Unknow
unsigned char *ipV4Address; //Only have meaning when printer support Network
unsigned char *hostName; //Only have meaning when printer support Network
unsigned char *usbDevicePortPath;
unsigned char *modelName;
void *privatedParms;
} getprinterinfo_usbPrinterStateParms_Type;
typedef struct usableUSBPrinterList_S {
getprinterinfo_usbPrinterStateParms_Type *usbPrinterState;//获取打印机信息
struct usableUSBPrinterList_S *next;
} usableUSBPrinterList_Type;
usableUSBPrinterList_Type *currentUSBPrinterList = NULL;
调用的过程如下
typedef unsigned char (*GetCurrentUSBPrinterStatus)(getprinterinfo_usbPrinterStateParms_Type * , unsigned char **);
GetCurrentUSBPrinterStatus getUsb = (GetCurrentUSBPrinterStatus)myDll.resolve("GetCurrentUSBPrinterStatus");
getUsb((getprinterinfo_usbPrinterStateParms_Type*)&Widget::currentUSBPrinterList->usbPrinterState,&printerStatusMessage);
编译后输出的错误为
D:\Mine\ku\7_55\7_55\widget.cpp:60: error: cannot convert 'Widget::getprinterinfo_usbPrinterStateParms_Type*' {aka 'Widget::getprinterinfo_usbPrinterStateParms_S*'} to 'getprinterinfo_usbPrinterStateParms_Type*' {aka 'getprinterinfo_usbPrinterStateParms_S*'} in argument passing
..\7_55\widget.cpp:60:18: error: cannot convert 'Widget::getprinterinfo_usbPrinterStateParms_Type*' {aka 'Widget::getprinterinfo_usbPrinterStateParms_S*'} to 'getprinterinfo_usbPrinterStateParms_Type*' {aka 'getprinterinfo_usbPrinterStateParms_S*'} in argument passing
60 | getUsb((getprinterinfo_usbPrinterStateParms_Type*)&Widget::currentUSBPrinterList->usbPrinterState,&printerStatusMessage);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| Widget::getprinterinfo_usbPrinterStateParms_Type* {aka Widget::getprinterinfo_usbPrinterStateParms_S*}
说是类型不匹配,请改正一下