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

Thread: Linker problem - uafxcwd.lib

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,574

    Linker problem - uafxcwd.lib

    I have a problem which is slowly driving me nuts.... I have a large-ish project which ultimately builds a COM DLL. I'm compiling under VC++ 6 but there's no MFC involved here.

    Mostly, I build the project using my desktop PC - but I have a safety copy on my laptop PC and occasionally (e.g. at a customer's premises) I might make changes on the laptop machine. I use a version control system (Code Co-op) to keep the 2 copies in sync.

    Both copies compile perfectly in both Debug & Release modes without any errors or warnings. The Release version links correctly on both machines, again without any errors or warnings - but the Debug version only links correctly on my main desktop system.

    If I try to build the Debug version on my laptop machine I get the following errors:-

    uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in Impl.lib(Context.obj)
    uafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in Impl.lib(Context.obj); second definition ignored
    uafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___wargv
    uafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc


    The strange thing is that my desktop PC never seems to link to uafxcwd.lib. In fact, I can put it in the 'excludes' for the linker and the project still builds perfectly. However, if I try to exclude it from my laptop's project, I get about 300 x LNK2001 errors, along the lines....

    stdafx.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
    Impl.lib(Context.obj) : error LNK2001: unresolved external symbol __afxForceEXCLUDE
    EnumPropertyValues.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
    EnumSegments.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE


    In fact, every file in the project throws up the same LNK2001 error. Code Co-op reckons that the 2 projects are in sync so I don't understand why one project wants to link to uafxcwd.lib, whereas the other doesn't. I've opened Tools->Options->Directories and I checked that the search directories match on both systems (which they do - both for compiler & linker. The same directories in the same order).

    Firstly, can anyone tell me what uafxcwd.lib is? And why should one copy of the project need it when the other one doesn't?
    "A problem well stated is a problem half solved. - Charles F. Kettering

  2. #2
    Join Date
    Aug 2002
    Location
    Cluj-Napoca,Romania
    Posts
    3,496

    Re: Linker problem - uafxcwd.lib

    Do you have the exact same versions of Visual Studio, Visual Studio SPs on both machines? Same question goes for the Platform SDK's. Also take a look at the Visual Studio Options, the Directories section.
    Har Har

  3. #3
    Join Date
    Aug 2002
    Location
    Cluj-Napoca,Romania
    Posts
    3,496

    Re: Linker problem - uafxcwd.lib

    For your other question, uafxcwd is the Unicode MFC static link library ( debug version). Add the Unicode support to your Visual Studio installation or check the project settings to see if you are trying to make a Unicode build anywhere.
    Har Har

  4. #4
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,574

    Re: Linker problem - uafxcwd.lib

    Thanks for the quick replies....

    Quote Originally Posted by PadexArt
    Do you have the exact same versions of Visual Studio, Visual Studio SPs on both machines? .
    Basically, yes. They were even installed from the same physical disks - and yet, if I go to Help->About, the Product ID's are different

    Quote Originally Posted by PadexArt
    uafxcwd is the Unicode MFC static link library [...] see if you are trying to make a Unicode build anywhere.
    Actually, this is a Unicode project, so I'd expect Unicode support in both versions. The bit I don't understand is why MFC is being linked to one of the copies. This definitely isn't an MFC project.

    The only reference I can find to __afxForceEXCLUDE is in AFX.h - so I guess that this must be getting included by one of the copies but not the other. The reference seems to suggest that I need to link to NOLIB.OBJ - but neither version is linking to it at the moment
    "A problem well stated is a problem half solved. - Charles F. Kettering

  5. #5
    Join Date
    Aug 2002
    Location
    Cluj-Napoca,Romania
    Posts
    3,496

    Re: Linker problem - uafxcwd.lib

    Have you compared the DSP files ( the one on the laptop and the one on the desktop) to see if the 2 project indeed have identical settings?
    Har Har

  6. #6
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,574

    Re: Linker problem - uafxcwd.lib

    Yes, Padex. They're included in the Code Co-op project and are both in sync. However, since my last post I've discovered what the problem was (yippee!! I've only been chasing this for about 3 days!!)

    It turned out to be a precompiled header problem (oh, how I loathe precomipled headers - I've always found them to be nothing but trouble.)

    Anyway, I copied the PCH and PDB files from my desktop machine over to my laptop and everything now works... !
    "A problem well stated is a problem half solved. - Charles F. Kettering

  7. #7
    Join Date
    Aug 2002
    Location
    Cluj-Napoca,Romania
    Posts
    3,496

    Re: Linker problem - uafxcwd.lib

    Quote Originally Posted by John E
    Yes, Padex. They're included in the Code Co-op project and are both in sync.
    I do not trust them. We've just found out that none of the backups our system made can be used. So, an extra "manual" check might produce good times sometimes.

    Just for the sake of it, try to clean up your project ( completelly wipe off your debug folder) and do a rebuild all. Does that solve your problem?
    Har Har

  8. #8
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,574

    Re: Linker problem - uafxcwd.lib

    I already solved it by replacing those PDB and PCH files. This is an open source project which - for reasons I don't understand - will not build if precompiled headers are turned off. This would worry me if it was one of my own projects, so I've flagged it up to the project licensors (many times) but nobody seems to be bothered...
    "A problem well stated is a problem half solved. - Charles F. Kettering

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)