在菜单连接对话框时出现的错误
error C2512: 'CDAttribute0' : no appropriate default constructor available
该怎么解决

解决方案 »

  1.   

    上面是说这个类没有默认的构造函数,大约因为这个类的构造函数是要参数的,而你定义时没给它参数,例如你定义对象时写作:CDAttribute0 a1;但是它的构造函数却是定义成:
    CDAttribute0::CDAttribute0(XXX,XXX)的.
      

  2.   

    我的构造函数给参数了啊
    CDAttribute0::CDAttribute0(HoriData*h) : CPropertyPage(CDAttribute0::IDD)然后我在message里面是这样定义的
    CDAttribute0 a0
      

  3.   

    然后我在message里面是这样定义的
    CDAttribute0 a0
    ===================
    错了,它的构造函数中有参数,而你定义对象是没给它参数啊,应该是:CDAttribute0 a0(参数);
      

  4.   

    我在message里面又这样写的
    CDAttribute0 a0(HoriData*h);
    可是又出现了这个错误
    error C2664: 'AddPage' : cannot convert parameter 1 from 'class CDAttribute0 (__cdecl *)(struct HoriData *)' to 'class CPropertyPage *'
            There is no context in which this conversion is possible
    该怎么办 ==|||
      

  5.   

    CDAttribute0 a0(HoriData*h);
    ================
    能这样写吗?HoriData*h是什么啊,这里加的应该是一个参数啊,你写得怎么象是定义
      

  6.   

    我加了
    CDAttribute0 a0(*h);
    这样对不对
    是不是还要对h进行定义
      

  7.   

    HoriData *h = NULL;
    //初始化h
    CDAttribute0  a0(h); 
    楼主回去学学基础知识