void CInputDlg::OnOK()
{
UpdateData();
m_strName.TrimLeft();
m_strNo.TrimLeft();
if(m_strName.IsEmpty()||m_strNo.IsEmpty())
{
MessageBox("姓名或者学号不能为空");
}
else
{
data.OpenFile();
data.InsertStudent(m_strName.GetBuffer(0),m_strNo.GetBuffer(0),m_fScore1,m_fScore2,m_fScore3);
data.WriteFile();
}
// TODO: Add extra validation here
CDialog::OnOK();
}
一开始编译能通过,但是后来加上了data.OpenFile(); data.WriteFile();就出现链接错误,改回来后还是出现连接错误
StdAfx.obj : error LNK2005: "class StudentData data" (?data@@3VStudentData@@A) already defined in InputDlg.obj
Debug/StudentCtrl.exe : fatal error LNK1169: one or more multiply defined symbols found