Help with Compiling Error
-
Ok this is my source: ----------------------------------------------------- void CTycoonDlg::OnList() { //Displays changes... extern CListBox* OnList; // Set the first visible item in the list box to be the middle item OnList->SetTopIndex(OnList->GetCount()/2); } ----------------------------------------------------- I put the code inbetween it just there, and now I can't compile it... OnList is a list box, and when I try to compile it I get this error... --------------------Configuration: Tycoon - Win32 Debug-------------------- Compiling... TycoonDlg.cpp Linking... TycoonDlg.obj : error LNK2001: unresolved external symbol "class CListBox * OnList" (?OnList@@3PAVCListBox@@A) Debug/Tycoon.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Tycoon.exe - 2 error(s), 0 warning(s) Any Ideas? I'm not that good at debugging errors. Anyways, please keep it simple, I don't really understand much to MFC, im new to it. I know a bit to C++.
-
Ok this is my source: ----------------------------------------------------- void CTycoonDlg::OnList() { //Displays changes... extern CListBox* OnList; // Set the first visible item in the list box to be the middle item OnList->SetTopIndex(OnList->GetCount()/2); } ----------------------------------------------------- I put the code inbetween it just there, and now I can't compile it... OnList is a list box, and when I try to compile it I get this error... --------------------Configuration: Tycoon - Win32 Debug-------------------- Compiling... TycoonDlg.cpp Linking... TycoonDlg.obj : error LNK2001: unresolved external symbol "class CListBox * OnList" (?OnList@@3PAVCListBox@@A) Debug/Tycoon.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Tycoon.exe - 2 error(s), 0 warning(s) Any Ideas? I'm not that good at debugging errors. Anyways, please keep it simple, I don't really understand much to MFC, im new to it. I know a bit to C++.
extern CListBox* OnList
tells the compiler "there's a variable calledOnList
with typeCListBox*
that is declared in some other source file". Have you declaredOnList
in some other file? If not, it should probably be a local variable and you need to initialize the pointer before using it. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- You cannot stop me with paramecium alone!