Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

logout

weird linking error ???

This topic is 5129 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

*im using VS.NET* Okay i got a lib project, it compiles fine and everything Now i include the lib in my dll project i get some weird errors. Both project are compiled under /Mld It looks like some sort of a missmatch or somthing but be damned if I can find out how to fix it. I tryed using "/NODEFAULTLIB:library" thing but I was kinda unsecure on where to put it, and also what syntax I should use on it. If anybody could be kind to explain to me why I get these erros, and how I can avoid them, and also how I can fix it as it is now without rewriting to much of my code i did be greatefull. Below is all the errors: *btw "core" is the name of the dll project im trying to compile*
core error LNK2005: "private: __thiscall std::locale::_Locimp::_Locimp(class std::locale::_Locimp const &)" (??0_Locimp@locale@std@@AAE@ABV012@@Z) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCD.lib(typinfo.obj)
core error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCD.lib(typinfo.obj)
core error LNK2005: "private: void __thiscall std::locale::_Locimp::_Addfac(class std::locale::facet *,unsigned int)" (?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "protected: void __thiscall std::ios_base::_Init(void)" (?_Init@ios_base@std@@IAEXXZ) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "public: __thiscall exception::exception(class exception const &)" (??0exception@@QAE@ABV0@@Z) already defined in LIBCD.lib(stdexcpt.obj)
core error LNK2005: "public: __thiscall exception::exception(void)" (??0exception@@QAE@XZ) already defined in LIBCD.lib(stdexcpt.obj)
core error LNK2005: "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "public: __thiscall std::_Locinfo::~_Locinfo(void)" (??1_Locinfo@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP70D.dll)
core 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 render.obj
core 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 gOONLib.lib(grender.obj)
core 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 gOONLib.lib(grender.obj)
core error LNK2005: "public: __thiscall std::locale::locale(void)" (??0locale@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP70D.dll)
core 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 gOONLib.lib(grender.obj)
core error LNK2005: "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ) already defined in LIBCD.lib(stdexcpt.obj)
core error LNK2005: "public: virtual __thiscall std::ios_base::~ios_base(void)" (??1ios_base@std@@UAE@XZ) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "public: void __thiscall std::ios_base::_Addstd(void)" (?_Addstd@ios_base@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "public: void __thiscall std::locale::facet::_Register(void)" (?_Register@facet@locale@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "void * __cdecl operator new[](unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??_U@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z) already defined in msvcprtd.lib(MSVCP70D.dll)
core error LNK2005: __Getcvt already defined in msvcprtd.lib(MSVCP70D.dll)
core fatal error LNK1169: one or more multiply defined symbols found
core warning LNK4098: defaultlib ''MSVCRTD'' conflicts with use of other libs; use /NODEFAULTLIB:library

Share this post


Link to post
Share on other sites
Advertisement
Apparently, some of the components you''re compiling do not like your /Mld (LIBCD) flag. It''s possible that it''s overriden for some library files (MSVCP70D). Try compiling against another runtime.

Share this post


Link to post
Share on other sites
The error says you have redefinition of functions/methods. Is your DLL linking against libraries that your LIB is itself linked against?

Share this post


Link to post
Share on other sites
okay i tryed liking against some other run times and it still wont work.


Oluseyi:
I havent included any libs manualy in my lib project but prehaps
some other file im including does.

Is there anyway to make VS not include these functions ?


edit:
could it have anything to do with the way im declaring my namespace ?

i do it like this:


// .h
namespace foo
{
class MyFoo
{
public:
void Do();
};
};

// .cpp
include .h

namespace foo
{
void MyFoo::Do()
{
// some code
}
};


[edited by - LogouT on May 8, 2004 11:09:15 PM]

Share this post


Link to post
Share on other sites
Oluseyi:
okay thx for the help, it was that after all..
So after tricking a bit with the lib includes i got it working.


But now the $%Q%(Q*#&%_#(Q%& compiler wont generate a .lib only a .dll


So how are I suposed to set up a project where i dont want any precompiled headers, all i want is a empty progject(from the start, i will add my own files ofc) that generates a lib and a dll....

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!