这是结构
typedef struct PSetting
{
unsigned char Level;
unsigned int Mall;
unsigned int Many;
WCHAR* Name; // optional
} PSetting;
PSetting p;
p.Name = L"NewName";
p.Level = 5;
p.Mall= 0;
p.Mall= 0;
我需要为该结构创建一个成员,并将其传递给此API:
PSettingAPI(proxy, PSetting **p, NULL)
但是,这样做时会出现此错误:
no suitable conversion function from "PSetting" to "Psetting **" exists.
最佳答案
您试图直接传递PSetting
类型的对象。 API函数希望将指向PSetting
(PSetting ** p)的指针作为第二个参数。
PSetting p;
PSetting* pointerToPSetting = &p;
PSetting** pointerToPointerToPSetting = &pointerToPSetting;
现在,将pointerToPointerToPSetting传递给该函数。请注意,这可能是
PSetting
的二维数组。关于c++ - 指向struct C++中的指针的指针,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28641252/