注册 登录
编程论坛 VC++/MFC

该程序在VS2005中运行时为什么会出现以下错误(红字表示的):

kxfei5555w 发布于 2010-10-07 11:45, 656 次点击
BOOL CDlgall::OnInitDialog()
{
    CDialog::OnInitDialog();

    // TODO:  Add extra initialization here

    LV_COLUM lvc
        char*display[7]={"检查号","姓名","日期","性别","年龄","左右利","方式","诊断病历"};
        lvc.mask=LVCF_FMT|LVCF_TEXT|LVCF_SUBITEM|LVCF_WIDTH;
    lvc.fmt=LVCFMT_LEFT;
    lvc.cx=80;
    for(int i=0;i<7;i++)
    {
        lvc.iSubItem=i;
        lvc.pszText=display[i];
        m_List.InsertColumn(i,&lvc);
    }
m_List.SetExtendedStyle(m_List.GetExtendedStyle()|LVS_EX_FULLROWSELECT)    ;
    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
1>e:\14\14\dlgall.cpp(44) : error C2065: 'LV_COLUM' : undeclared identifier
1>e:\14\14\dlgall.cpp(44) : error C2146: syntax error : missing ';' before identifier 'lvc'
1>e:\14\14\dlgall.cpp(44) : error C2065: 'lvc' : undeclared identifier
1>e:\14\14\dlgall.cpp(44) : error C2144: syntax error : 'char' should be preceded by ';'
1>e:\14\14\dlgall.cpp(44) : error C2078: too many initializers
1>e:\14\14\dlgall.cpp(45) : error C2146: syntax error : missing ';' before identifier ';'
1>e:\14\14\dlgall.cpp(45) : error C2065: ';' : undeclared identifier
1>e:\14\14\dlgall.cpp(45) : error C2146: syntax error : missing ';' before identifier 'lvc'
1>e:\14\14\dlgall.cpp(45) : error C2228: left of '.mask' must have class/struct/union
1>        type is ''unknown-type''
1>e:\14\14\dlgall.cpp(46) : error C2228: left of '.fmt' must have class/struct/union
1>        type is ''unknown-type''
1>e:\14\14\dlgall.cpp(47) : error C2228: left of '.cx' must have class/struct/union
1>        type is ''unknown-type''
1>e:\14\14\dlgall.cpp(50) : error C2228: left of '.iSubItem' must have class/struct/union
1>        type is ''unknown-type''
1>e:\14\14\dlgall.cpp(51) : error C2228: left of '.pszText' must have class/struct/union
1>        type is ''unknown-type''
1>e:\14\14\dlgall.cpp(52) : error C2065: 'm_List' : undeclared identifier
1>e:\14\14\dlgall.cpp(52) : error C2228: left of '.InsertColumn' must have class/struct/union
1>        type is ''unknown-type''
1>e:\14\14\dlgall.cpp(54) : error C2228: left of '.SetExtendedStyle' must have class/struct/union
1>        type is ''unknown-type''
1>e:\14\14\dlgall.cpp(54) : error C2228: left of '.GetExtendedStyle' must have class/struct/union
1>        type is ''unknown-type''
1>Build log was saved at "file://e:\14\14\Debug\BuildLog.htm"
2 回复
#2
红色警戒2010-10-07 13:37
应该是LV_COLUMN
#3
kxfei5555w2010-10-07 15:03
回复 2楼 红色警戒
谢谢!
1