no appropriate default constructor available出现这句话,一般是哪里出问题了~
我怎么找也找不出来~

解决方案 »

  1.   

    CTest::CTest()
    {
    }????/还是不行
      

  2.   

    你得TEST从哪个类派生?父类名也要加上.
      

  3.   

    析构好像不一定要吧?CDialog就没有。
      

  4.   

    class CB
    {
           int m_na
    CB(){m_na=0;}
    }class CT:public CB
    {
           int m_nb;
             CT(){m_nb=0;}
    }代码是这样的
    谢~
      

  5.   

    还怕我们偷你得程序啊.
    我记得CDialog类会出这种问题
      

  6.   

    更令人生气的是
    居然出现了c:\program files\microsoft visual studio\vc98\include\vector(91) : fatal error C1001: INTERNAL COMPILER ERROR
            (compiler file 'msc1.cpp', line 1786) 
             Please choose the Technical Support command on the Visual C++ 
             Help menu, or open the Technical Support help file for more information
    Command line warning D4028 : minimal rebuild failure, reverting to normal build
    :(
      

  7.   

    class CDisplay;class CAnimationBitmapX: public CBitmapX
    {
    public:
    // 數據操作
    void PlayAnimation(void) { m_bIsPlay = true; AddPostion(); }
    void StopAnimation(void) { m_bIsPlay = false; } // 屬性設置部分
    int GetAnimationLength() { return m_lFrame; }
    void SetAnimationPosition(int nNewPos) { m_lNowPos = nNewPos; }
    void SetAnimationSpeed(int nSpeed) { m_lSpeed = nSpeed; }
    void SetAnimationColorKey(PIXEL color);
    void SetColorKey(PIXEL value); void AddPostion(void);
    void DecPostion(void);
    CBitmapX* GetNowPosFrame(void);
    void Reset(void);
    void SetSpeed(int nSpeed) { m_lSpeed = nSpeed; }public:
    ~CAnimationBitmapX(void);public:
    CAnimationBitmapX();
    list<CBitmapX* > m_FrameList;
    BitmapIterator  m_FramePos; bool m_bIsPlay; long m_lFrame;
    long m_lNowPos;
    long m_lSpeed;private:
    long m_lSpeedCount;
    };//声明//////////////////////////////////////////////////////////////////////
    // Construction/Destruction
    //////////////////////////////////////////////////////////////////////
    CAnimationBitmapX::CAnimationBitmapX()
    {
    m_lType = BITMAP_TYPE_ANIMATION; m_bIsPlay = true;
    m_lFrame = 0;
    m_lNowPos = 0;
    m_lSpeed = 1;
    m_lSpeedCount = 0;}
    .....(恕多)
    //实现
    class CBitmapX  
    {public:
    void SetWidth(int value) { m_nWidth = value; }
    void SetHeight(int value) { m_nHeight = value; }
    void SetColorKey(PIXEL value);
    void SetColorKey(DWORD value);
    long GetWidth(void) { return m_nWidth; }
    long GetHeight(void) { return m_nHeight; }
    void SetPitch(long value) { m_nPitch = value; m_nPitchWidth = value+m_nWidth; } PIXEL GetPixel(int x, int y);
    private:
    int GetDiffLength(int x, int y, PIXEL data, long lLength);
    int GetSameLength(int x, int y, PIXEL data, long lLength); DWORD ConvertGDIColor( COLORREF dwGDIColor );
    private:
    virtual void PlayAnimation(void) { return; }
    virtual void StopAnimation(void) { return; }
    virtual int GetAnimationLength() { return 0; }
    virtual void SetAnimationPosition(int nNewPos) { return; }
    virtual void SetAnimationSpeed(int nSpeed) { return; }
    virtual void SetAnimationColorKey(PIXEL color) { return; }
    virtual void AddPostion(void) { return; }
    virtual void DecPostion(void) { return; }
    virtual CBitmapX* GetNowPosFrame(void) { return NULL; }
    virtual void Reset(void) { return; }
    virtual void SetSpeed(int nSpeed) { return; }public:
    CBitmapX();
    virtual ~CBitmapX();public:
    int m_nWidth;
    int m_nHeight; // 扩展,用于事先计算memcpy的size
    int m_nPitch; // 数据对齐
    int m_nPitchWidth; // 對其後的數據
    int m_nLength; // 数据长度,只对RLE压缩有效
    LPDIRECTDRAWSURFACE7 m_pSurface; // 2D Surface
    PIXEL* m_pBuffer; // Bitmap Buffer
    unsigned char* m_pAlphaData; // Alpha Channel
    bool m_bIsAlphaChannel; // is't use alpha channel PIXEL m_dwColorKey; // Color Key long m_lStatus; // Bitmap Status
    long m_lType; // Bitmap Type (stand or animation)
    long m_lSurfaceType; // Surface Type
    };
    //声明CBitmapX::CBitmapX()
    {
    m_lType = BITMAP_TYPE_STAND;
    m_nWidth = 0;
    m_nHeight = 0;
    m_nPitch = 0;
    m_nLength = 0;
    m_nPitchWidth = 0;
    m_pSurface = NULL;
    m_pBuffer = NULL;
    m_pAlphaData = NULL;
    m_bIsAlphaChannel = false; // default: don't use alpha channel
    m_dwColorKey = 0; // default=0, no use color key m_lStatus = TYPE_BUFFER; // default: buffer data
    m_lSurfaceType = NULL;
    }
    ....(恕多)//实现然后我在调用
    CAnimationBitmapX* pAni = new CAnimationBitmapX;
    编链出错
    c:\my documents\game\display.cpp(4786) : error C2512: 'CAnimationBitmapX' : no appropriate default constructor available
      

  8.   

    你试试在CAnimationBitmapX(),CBitmapX()中对所有可以赋值的变量,全部赋值.
      

  9.   

    如果我的
    CAnimationBitmapX 中的构造函数是这样的
    CAnimationBitmapX::CAnimationBitmapX(int x)
    {
    ...
    }我也知道要加一个CAnimationBitmapX::CAnimationBitmapX()
    {
    }可是现在!
    呜.......
      

  10.   

    是有些奇怪!
    如果
    CAnimationBitmapX的构造
    为CAnimationBitmapX(int x)这样再加上一个为CAnimationBitmapX::AnimationBitmapX(){}应该没有问题~:(好吧~谢谢你了~
    我回去再好好看看好了~分我会在稍候给出的~:)
    看我的信誉也知道了~:)
      

  11.   

    问题解决了~是在调用代码的文件中没有包含派生的声明
    后来
    #include "AnimationBitmapX.h"
    解决~:)