Linker Errors, Help Appreciated

This is a discussion on Linker Errors, Help Appreciated within the Windows Programming forums, part of the Platform Specific Boards category; I'm getting these linker errors and I've been trying for a while now to fix them to no avail. Any ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    4

    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.


    /out:LocalizeRC.exe
    LocalizeRC.obj
    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:

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


    and the definition is in my .cpp file:

    Code:
    // 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,

    Stephanie

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21