Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help with Compiling Error

Help with Compiling Error

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpdebuggingquestionworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arunforce
    wrote on last edited by
    #1

    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++.

    M 1 Reply Last reply
    0
    • A arunforce

      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++.

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      extern CListBox* OnList tells the compiler "there's a variable called OnList with type CListBox* that is declared in some other source file". Have you declared OnList 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!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups