CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: LINK2005

  1. #1
    Join Date
    Sep 1999
    Location
    Quebec, Canada
    Posts
    7

    LINK2005

    Hi,

    i have this link error only when i compile my project in release mode. The debug mode is ok.
    My project (.exe) must link many lib together, all lib compile correctly in release mode.

    The code generation is the same for all, MultiThreadDll.

    The error :
    nafxcw.lib(strcore.obj) : error LNK2005: "public: __thiscall CString::CString(class CString const &)" (??0CString@@QAE@ABV0@@Z) already defined in mfc42.lib(MFC42.DLL)

    great thanks in advance

    Carl


  2. #2
    Join Date
    Dec 2002
    Location
    New Jersey
    Posts
    12
    Carl,

    I've run into this before. The thing is that different DLLs are used by the release and debug versions.

    What you have to do is to ignore the nafxcw.lib library in your release build.

    I Visual Studio.NET (VC 7) make sure on the right side you have solution explorer selected. Right click on the appropriate project, choose properties, choose linker, choose input and in ignore specific library type in this library name. (nafxcw.lib) You may have to repeat this step as more may show up.

    In VC6 choose menu option project / setting. Go to link tab. Choose category Input. In the Ignore Libraries edit box put nafxcw.lib. Once again realize that you may have to add more than one.

    Gary

  3. #3
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917
    See if you have projects that use libraries linked statically with MFC and libraries that use MFC as dynamic (shared) libraries you most likely will have this problem. I do not think that ignoring some will fix your problem.

    If you can re-link all libraries to use the same type of linkage.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

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