views:

685

answers:

3

Hi

any body plzzzzzz help me to remove linker error 2005. I am vexed with these errors

libcmtd.dll msvmrtd.dll some element(ex: _mkdir ) alredy defined like error..

ur support wil greatly help for me.

"private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.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 LIBCMTD.lib(typinfo.obj)

+1  A: 

Your problem is that you're linking with two files providing the same symbol.

You haven't provided the real error message so we can't tell you exactly what the problem is but it's likely to be that you're linking with libraries from two different versions of Visual Studio.

There are also solutions available by searching the web (I assume you did this but just missed the articles in question :-) that suggest you can fix the problem by changing the project options from "Multi-threaded Debug(/MTd)" to "Multi-threaded Debug DLL (/MTD)" but I haven't looked in to this.

Please post the complete error so we can offer more targeted assistance.

paxdiablo
http://stackoverflow.com/questions/935161/visual-c-runtime-library-linker-woesplzzzz check this link once.
Cute
plzzzzzz go through http://stackoverflow.com/questions/935161/visual-c-runtime-library-linker-woes
Cute
+1  A: 

Check a few things:

  1. Are your header files guarded. I.e. do they have #ifndef guards.

  2. Are you defining (non-template) functions in headers without the inline keyword. That messes lots of stuff up.

  3. Are you trying to define templates in a .cpp file. All template definitions need to be in headers.

Post some code and exact error text please!

rlbond
+1: When I used C++ and lnk2005 errors stumped me for days, the fix was `#ifndef` guards.
Jim Schubert
A: 

The MSDN article on LNK4098 has a very useful table: it tells you which libraries to manually add to the "Ignore specific library" list, depending on which CRT you're using. You need to pick a CRT (Multithreaded or not; static or DLL; debug or release), and then add the ignore libraries based on your choice.

The underlying cause is described in more detail in KB154753 ... libraries that a program will link with when built by using Visual C++

My interpretation of this is that in certain situations the algorithm that automatically picks which CRT libraries to link your code with will pick several conflicting libraries.

romkyns