Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC app + lib that includes STL linking probs

MFC app + lib that includes STL linking probs

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Steve The Plant
    wrote on last edited by
    #1

    Hi! I'm building an MFC application and I'm trying to link a home made .lib to it. The library uses the STL. When I try to compile the MFC app, I get messages like these: error LNK2005: "public: __thiscall std::basic_string<*snip*> already defined in MainFrm.obj and MSVCRT.lib(MSVCRT.dll) : error LNK2005: _memmove already defined in libcmt.lib(memmove.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _vsprintf already defined in libcmt.lib(vsprintf.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in libcmt.lib(fclose.obj) I can work around it, but I don't know what the root problem is. I think it's releated to which run time library the app uses. Any ideas? Shawn

    D C S 3 Replies Last reply
    0
    • S Steve The Plant

      Hi! I'm building an MFC application and I'm trying to link a home made .lib to it. The library uses the STL. When I try to compile the MFC app, I get messages like these: error LNK2005: "public: __thiscall std::basic_string<*snip*> already defined in MainFrm.obj and MSVCRT.lib(MSVCRT.dll) : error LNK2005: _memmove already defined in libcmt.lib(memmove.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _vsprintf already defined in libcmt.lib(vsprintf.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in libcmt.lib(fclose.obj) I can work around it, but I don't know what the root problem is. I think it's releated to which run time library the app uses. Any ideas? Shawn

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      Try changing the C Runtime libs of your application to match your lib. This way, CRT symbols won't get duplicated. Concussus surgo. When struck I rise.

      1 Reply Last reply
      0
      • S Steve The Plant

        Hi! I'm building an MFC application and I'm trying to link a home made .lib to it. The library uses the STL. When I try to compile the MFC app, I get messages like these: error LNK2005: "public: __thiscall std::basic_string<*snip*> already defined in MainFrm.obj and MSVCRT.lib(MSVCRT.dll) : error LNK2005: _memmove already defined in libcmt.lib(memmove.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _vsprintf already defined in libcmt.lib(vsprintf.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in libcmt.lib(fclose.obj) I can work around it, but I don't know what the root problem is. I think it's releated to which run time library the app uses. Any ideas? Shawn

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Most of this has nothing to do with the STL, but rather the C runtime library. Christian We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum ) Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002

        1 Reply Last reply
        0
        • S Steve The Plant

          Hi! I'm building an MFC application and I'm trying to link a home made .lib to it. The library uses the STL. When I try to compile the MFC app, I get messages like these: error LNK2005: "public: __thiscall std::basic_string<*snip*> already defined in MainFrm.obj and MSVCRT.lib(MSVCRT.dll) : error LNK2005: _memmove already defined in libcmt.lib(memmove.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _vsprintf already defined in libcmt.lib(vsprintf.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in libcmt.lib(fclose.obj) I can work around it, but I don't know what the root problem is. I think it's releated to which run time library the app uses. Any ideas? Shawn

          S Offline
          S Offline
          Steve The Plant
          wrote on last edited by
          #4

          Looks like that works. Thanks :) Shawn

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups