我有一个 SDK(GigE C++),它定义了一个像这样的类:
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
语法正确吗?为什么要上课?正确的方法是什么?