News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

[RESOLVED] double definition of library and linker option : LNK2005

Started by antonien, February 05, 2011, 02:27:17 PM

Previous topic - Next topic

antonien

Compiling my program, I run through 50+ errors of this kind :
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

antonien

#1
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 :
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 ?

antonien

Uh ! I did it, and now I have this kind of warnings :
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.

antonien

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)