Author Topic: [RESOLVED] double definition of library and linker option : LNK2005  (Read 9832 times)

Offline antonien

  • Multiple posting newcomer
  • *
  • Posts: 24
Compiling my program, I run through 50+ errors of this kind :
Code
MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)

I did a search on this forum and found an interesting topic on it here.
It says that I have to put a /NODEFAULTLIB:LIBC command in the linker options. I guess in my case it'll be /NODEFAULTLIB:LIBCMTD...

The problem is : I can't figure out where to put it : is it in the build options ? in the compiler & debugger settings ? In category ?

Thanks in advance for your answer.

Best regards
« Last Edit: February 05, 2011, 03:58:52 pm by antonien »

Offline antonien

  • Multiple posting newcomer
  • *
  • Posts: 24
Re: double definition of library and linker option : LNK2005
« Reply #1 on: February 05, 2011, 02:43:20 pm »
OK, I got it, it's in the other linker options just on the right of the linker settings.

But now I have another bunch of warnings :
Code
msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" 
(?_Xlength_error@std@@YAXPBD@Z) already defined in libcpmtd.lib(xthrow.obj)
I guess I have to do the same with libcpmtd.lib ?
« Last Edit: February 05, 2011, 02:45:22 pm by antonien »

Offline antonien

  • Multiple posting newcomer
  • *
  • Posts: 24
Re: double definition of library and linker option : LNK2005
« Reply #2 on: February 05, 2011, 02:52:53 pm »
Uh ! I did it, and now I have this kind of warnings :
Code
msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)"
(??1_Container_base12@std@@QAE@XZ) already defined in Ecranbleu.obj
It looks like I simply moved the error from one point to another one !

Anybody can give me a cue ?

Thanks in advance.

Offline antonien

  • Multiple posting newcomer
  • *
  • Posts: 24
Re: double definition of library and linker option : LNK2005
« Reply #3 on: February 05, 2011, 03:58:27 pm »
Well... digging more deeply into the forum, I read something about multithreaded static and dynamic libraries.
I had my project rebuilt in dynamic. I went for static because I couldn't buid a DLL based version of wxWidgets... obviously, it has nothing to do with that and I didn't cach the point.

Now it compiles. At least, I have more common errors and I close this topic 8)