程序中通过多选LISTBOX显示了一个文本文件,通过一个获取按钮来显示我选中的内容。获取按钮
的代码如下:
void CLoad::OnLoadbutton()
{
// The pointer to my list box.
extern CListBox *pmylist;
CString str;
// Get the indexes of all the selected items.
int nCount = pmylist->GetSelCount();
for(int i=0;i<pmylist->GetCount();++i)
if(pmylist->GetSel(i))
{
pmylist->GetText(0,str);
MessageBox(str);
}
}可是编译不通过,错误代码如下:
inking...
Load.obj : error LNK2001: unresolved external symbol "class CListBox * pmylist" (?pmylist@@3PAVCListBox@@A)
Debug/APC.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.APC.exe - 2 error(s), 0 warning(s)
大家帮着解决一下啊,急,不知道原因
的代码如下:
void CLoad::OnLoadbutton()
{
// The pointer to my list box.
extern CListBox *pmylist;
CString str;
// Get the indexes of all the selected items.
int nCount = pmylist->GetSelCount();
for(int i=0;i<pmylist->GetCount();++i)
if(pmylist->GetSel(i))
{
pmylist->GetText(0,str);
MessageBox(str);
}
}可是编译不通过,错误代码如下:
inking...
Load.obj : error LNK2001: unresolved external symbol "class CListBox * pmylist" (?pmylist@@3PAVCListBox@@A)
Debug/APC.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.APC.exe - 2 error(s), 0 warning(s)
大家帮着解决一下啊,急,不知道原因
extern CListBox *pmylist;void CLoad::OnLoadbutton()
{
CString str;
// Get the indexes of all the selected items.
int nCount = pmylist->GetSelCount();
for(int i=0;i<pmylist->GetCount();++i)
if(pmylist->GetSel(i))
{
pmylist->GetText(0,str);
MessageBox(str);
}
}
放到了外面还是同样的错误,请解答
extern CListBox *pmylist;
的声明,那你的pmylist是在那儿定义的呢?