Skip to main content
GameDev.net gamedev.net
🔒 Locked 🤖 Godot

I need help creating a static lib

Started by donjonson Mar 28, 2006 at 5:47 PM 2 replies 1.6k views
Original Post
donjonson
donjonson
I am going thought this tutorial http://msdn2.microsoft.com/en-us/library/ms235627.aspx I am using VC++ 2005 express I get to the point where I try to build the whole solution and I get the following linker errors.
[SOURCE]mathfuncslib.lib(MathFuncsLib.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in MyExecRefsLib.obj
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in MyExecRefsLib.obj
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in MyExecRefsLib.obj
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in MyExecRefsLib.obj
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in LIBCMT.lib(stdexcpt.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in LIBCMT.lib(stdexcpt.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library[/SOURCE]
any Ideas what I have done wrong?
These tears..leave scars...as they run down my face.
donjonson
donjonson
nobody has any clue?
These tears..leave scars...as they run down my face.
Run_The_Shadows
Run_The_Shadows
Read the link errors, they're pretty self-explanatory.
All eight of them are whining because you've somehow duplicated certain objects.
msvcprtd.lib is conflicting with your MyExecRefsLib.obj, MSVCRTD.lib is conflicting with LIBCMT.lib. I'd suggest telling the linker to ignore MSVCRTD(much like the linker is telling you to do with that final message) and then try to sort out exactly what's going on in with the first two libraries.

Templated functions(and the STL in general) can generate some really funked up error messages due to how they operate, but trying to decipher it looks like you might be trying to redefine certain std::string related things. What's confusing me on this point is that if you get through the template-junk of the errors,it almost looks like it says:
public: std::string::-std::string (void)public: std::string::std::string(char const *)public: std::string::std::string(class std::string)public: char const* std::string::c_str(void)const


which leads me to believe you're attempting to either redefine std::string functions or are writing duplicate declarations of them.
donjonson
donjonson
actually I have done none of those things. The only functions I had in there were named add, sub, mult, div. It had something to do with using debug libs for a release build. I had to ignore the problem libs in the linker options and that fixed it.
These tears..leave scars...as they run down my face.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.