MFC app + lib that includes STL linking probs
-
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
-
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
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.
-
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
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
-
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
Looks like that works. Thanks :) Shawn