CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2001
    Location
    CA , USA
    Posts
    83

    linking with static mfc library

    Hi

    my application runs fine when i run using mfc in shared dll. But when i switch to use mfc in static linking it give some linking problems.Im using some external libraries also.
    The linking errors look some thing like this..

    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __free_dbg
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __malloc_dbg
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtSetAllocHook
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtSetDbgFlag
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __CrtSetDbgFlag
    nafxcwd.lib(dumpinit.obj) : error LNK2001: unresolved external symbol __CrtSetDbgFlag
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtSetBreakAlloc
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtCheckMemory
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtIsMemoryBlock
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtMemDifference
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtMemDumpStatistics
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtMemCheckpoint
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtMemDumpAllObjectsSince
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtDoForAllClientObjects
    nafxcwd.lib(afxmem.obj) : error LNK2001: unresolved external symbol __CrtDumpMemoryLeaks
    nafxcwd.lib(dumpinit.obj) : error LNK2001: unresolved external symbol __CrtDumpMemoryLeaks
    nafxcwd.lib(olesvr2.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(oleipfrm.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(olelink.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(olecli2.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(oledoctg.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(oledocvw.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(olesvr1.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(oledlgs1.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(olestrm.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(oledoc1.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(olecli1.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(oledisp2.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(oletyplb.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(olemisc.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(olefact.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(occcont.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(occsite.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(oledisp1.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(olevar.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(doccore.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(filecore.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(afxasert.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(dumpcont.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
    nafxcwd.lib(dumpinit.obj) : error LNK2001: unresolved external symbol __CrtSetReportMode
    nafxcwd.lib(dumpinit.obj) : error LNK2001: unresolved external symbol __CrtSetReportHook
    nafxcwd.lib(dumpinit.obj) : error LNK2001: unresolved external symbol __CrtSetDumpClient



    Any help is greately appreciated,


    Thanks
    shashi


  2. #2
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    2,147

    Re: linking with static mfc library


    The linking problems you have are related to the debug elements of the DLLs. You should not statically link the debug DLLs.

    There really is no need to either, as you shouldn't distribute debug versions of your application.

    If you intend to statically link the release version, that should be fine. You should not get these problems.

    Hope this helps,

    - Nigel



  3. #3
    Join Date
    Apr 2001
    Location
    CA , USA
    Posts
    83

    Re: linking with static mfc library

    hi
    thanks for your reply..
    Im trying to link statically now with release mode.But still im getting some linking errors..


    nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
    nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
    nafxcw.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
    nafxcw.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
    nafxcw.lib(dcprev.obj) : error LNK2001: unresolved external symbol __mbctype
    nafxcw.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
    Release/XRayMicroscope.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.




    Thanks
    shashi




  4. #4
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    2,147

    Re: linking with static mfc library


    1) Do a search for argv in your application, and show me what returns.

    2) Do the same for mbctype, only show the first 4 or 5 lines returned.

    - Nigel



  5. #5
    Join Date
    Apr 2001
    Location
    CA , USA
    Posts
    83

    Re: linking with static mfc library

    Hi
    Thanks again for your reply. But im not using them in my project. If a 3rd party libraray that i use has that or not i dont know. In my project i have not used them.

    thanks
    shashi


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