Thread: Linker Errors, Help Appreciated

  1. #1
    Registered User
    Join Date
    Mar 2006

    Exclamation Linker Errors, Help Appreciated

    I'm getting these linker errors and I've been trying for a while now to fix them to no avail. Any help would be greatly appreciated.

    LocalizeRC.obj : error LNK2001: unresolved external symbol "public: __thiscall CLocalizeRCDlg::CLocalizeRCDlg(class CWnd *)" (??0CLocalizeRCDlg@@$$FQAE@PAVCWnd@@@Z)
    libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
    LocalizeRC.exe : fatal error LNK1120: 2 unresolved externals

    My declaration is in a .h file as follows:

    // CLocalizeRCDlg dialog
    class CLocalizeRCDlg : public CDialog
    // Construction
    	CLocalizeRCDlg(CWnd* pParent = NULL) //standard constructor

    and the definition is in my .cpp file:

    // CLocalizeRCDlg dialog
    CLocalizeRCDlg::CLocalizeRCDlg(CWnd* pParent /*=NULL*/): CDialog(CLocalizeRCDlg::IDD, pParent)
    	, m_bCopy(FALSE)
    	, m_nObsoleteItems(0)
    	, m_strWorkspace(_T(""))
    	, m_strEdit(_T(""))
    	, m_strTextmode(_T(""))
    	, m_bNoSort(FALSE)
    	, m_strInputRC(_T(""))
    	, m_strLangINI(_T(""))
    	, m_strOutputRC(_T(""))
    	, m_strAbout(_T(""))
    	// last used Workspace from registry
    	m_strWorkspace = AfxGetApp()->GetProfileString( SEC_LASTPROJECT, ENT_WORKSPACE );

    If i move the definition to the .h file as well then the error LNK2001 above is no longer a problem. However then the project can't link with other definitions and they come up as LNK2001 errors. I don't want to move all my definitions in the .cpp file to the .h file if possible.

    As for the libcmt.lib(crt0.obj) : error LNK2019 ... I've no idea why that is coming up so any help with that would also be great.

    Many thanks,


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > As for the libcmt.lib(crt0.obj) : error LNK2019 ... I've no idea why that is coming up
    You've got a winmain(), but it's looking for main()
    Check which type of project you're creating (console or GUI) and adjust accordingly.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Hi think i've got it working now. Thanks for your help!

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Wow that's an ugly constructor.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker errors with Templates...
    By Petike in forum C++ Programming
    Replies: 2
    Last Post: 09-03-2008, 09:52 AM
  2. linker errors
    By kumarangopi in forum C Programming
    Replies: 3
    Last Post: 11-13-2006, 01:28 PM
  3. Sneaky little linker errors...
    By Tozar in forum C++ Programming
    Replies: 8
    Last Post: 10-25-2006, 05:40 AM
  4. gotta love linker errors
    By dantestwin in forum C++ Programming
    Replies: 3
    Last Post: 07-08-2004, 05:53 PM
  5. Linker errors with simple static library
    By Dang in forum Windows Programming
    Replies: 5
    Last Post: 09-08-2001, 09:38 AM
Website Security Test