0

IplImage ラッパーを作成しようとしています。

これが私のコードです:

class DrawingDetector
{
public:
    typedef boost::shared_ptr<IplImage> ipl_image_ptr_t;

    DrawingDetector(){}
    DrawingDetector::DrawingDetector(IplImage* img) : m_image(img, ipl_deleter){}

private:

    static void ipl_deleter( IplImage* ipl_img )
    {
        if( ipl_img )
        {
            cvReleaseImage( &ipl_img );
        }
    }

    ipl_image_ptr_t m_image; // compiler error "field ‘m_image’ has incomplete type"

};

「フィールド 'm_image' の型が不完全です」というコンパイル エラーが発生しました。私のコンパイラは gcc 4.4 です。

空の shared_ptr を作成できないのはなぜですか?

4

3 に答える 3

3

フィールドには type があるため、boost::shared_ptr<IplImage>含まれていないboost/shared_ptr.hppか、および/またはヘッダーを定義していないようですIplImageIplImage前方宣言のみを提供するだけで十分な場合があるためです。

于 2013-04-03T15:02:27.287 に答える