1
我有一個SDK(千兆以太網C++),它定義了這樣的一類:錯誤C2228:左 '.Alloc' 必須具有類/結構/聯合
class PV_BUFFER_API PvBuffer
{
public:
PvBuffer();
virtual ~PvBuffer();
PvPayloadType GetPayloadType() const;
#ifndef PV_NODEPRECATED
PvResult Alloc(PvUInt32 aSizeX, PvUInt32 aSizeY, PvPixelType aPixelType);
};
的SDK的文件說:
PvResult PvBuffer::Alloc (PvUInt32 aSizeX,
PvUInt32 aSizeY,
PvPixelType aPixelType
)
Allocates memory for this PvBuffer.
Parameters:
[in] aSizeX The width of the image, in pixels. See GetWidth.
[in] aSizeY The height of the image, in pixels. See GetHeight.
[in] aPixelType The GEV pixel type from which the pixel depth is extracted. For
supported pixel types, see PvPixelType.h.
Returns:
Includes:
PvResult::Code::OK
PvResult::Code::NOT_ENOUGH_MEMORY
我想使用的功能的Alloc(請參閱類的最後一個函數)。所以我寫這樣的程序:
PvBuffer *lBuffer; //Class name is PvBuffer
PvResult lResult= lBuffer.Alloc(1224, 1029, PVPIXELMONO);
但它給錯誤,其中之一是:
error C2228: left of '.Alloc' must have class/struct/union
是語法是否正確?爲什麼它是要求類?什麼是正確的方法是什麼?
這是否和現在智能感知報告:錯誤:重載函數的任何實例「PvBuffer ::黃金」的參數列表匹配...是因爲我的參數錯了? – gpuguy
@gpuguy首先編譯。智能感知不是一個編譯器。 –
@gpuguy還,這是一個完全不同的問題。 :) –