CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2000
    Location
    Ottawa, CANADA. (CNADA ROCKS!!)
    Posts
    1,895

    Linker error with CString only in debug

    vc 7.0 env.

    I have a exported method that takes a CString as a param. The project that calls this method generates a unresolved external only in dubug. In release its ok.

    If I add a wrapper method that takes a LPCTSTR instead of the CString it works.

    The actual error is:
    clSelectProjectDlg.obj : error LNK2019: unresolved external symbol "public: void __thiscall clFieldDefinition::Name(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > const &)" (?Name@clFieldDefinition@@QAEXABV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) referenced in function "long __cdecl ConvertField(class clFieldDefinition &,struct IField *)" (?ConvertField@@YAJAAVclFieldDefinition@@PAUIField@@@Z)
    ISDesktopAccess.obj : error LNK2001: unresolved external symbol "public: void __thiscall clFieldDefinition::Name(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > const &)" (?Name@clFieldDefinition@@QAEXABV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z)
    TaskPusherCtrl.obj : error LNK2001: unresolved external symbol "public: void __thiscall clFieldDefinition::Name(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > const &)" (?Name@clFieldDefinition@@QAEXABV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z)

    anyone seen this error before? if so what is the cause and resolution
    and Canada rocks!! Peace bro.

  2. #2
    Join Date
    Aug 2005
    Posts
    115

    Re: Linker error with CString only in debug

    See if this information is helpful:

    LNK2019
    LNK2001

    Linker errors similar to this used to cause me numerous headaches using previous versions of VC++. They were notoriously difficult to track down and fix. They usually turned out to be problems with how I created the initial project. Some how I was getting the single-threaded libraries mixed up with the multi-threaded ones, and the debug libraries mixed up with the release libraries. The easy fix was to link the release version statically to the MFC libraries. This also avoided problems we were having with DLL H***.

    I don't know if this helps you or not. I haven't really used VC++ 7.0, so I don't know if these same problems are still issues.

  3. #3
    Join Date
    Feb 2002
    Location
    Krispl, Austria
    Posts
    197

    Re: Linker error with CString only in debug

    You need to create an MFC Extension dll if you are using MFC or if using the ATL CString implementation you need to try the steps outlined here
    http://support.microsoft.com/default...b;EN-US;168958
    Requests such as
    "I need to write an new language compiler by next week, I have teach yourself c++ in 21 days, can someone give me example code?" will be ignored.

  4. #4
    Join Date
    Oct 2000
    Location
    Ottawa, CANADA. (CNADA ROCKS!!)
    Posts
    1,895

    Re: Linker error with CString only in debug

    Thanks to all.

    But why do I only get error in debug build???
    and Canada rocks!! Peace bro.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured