[Botan-devel] Linking problem Botan 1.8.0 + VC2008

Jack Lloyd lloyd at randombit.net
Tue Jan 20 14:10:04 EST 2009

On Tue, Jan 20, 2009 at 03:48:59PM +0100, cubeltd at poczta.fm wrote:

> 1>Linking...
> 1>msvcprtd.lib(MSVCP90D.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 at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at XZ) already defined in libbotan.lib(init.obj)
> I guess it%u2019s problem with configuration of linker option but I%u2019m not able to find correct configuration. Could you give me any hints or instruction how should it be configured?

> Moreover during compilation I see a lot of warnings such:
> Compiling...
> 1>botan_test_1.cpp
> 1>c:\botan\botan\exceptn.h(19) : warning C4275: non dll-interface class 'std::exception' used as base for dll-interface class 'Botan::Exception'
> 1>        c:\program files\microsoft visual studio 9.0\vc\include\exception(95) : see declaration of 'std::exception'

> What can be done to avoid such wornigs?

I don't use Visual C++ much myself but I am pretty sure these are both
related to the choice of runtime libraries. Microsoft, in their
infinite wisdom, provides multiple C/C++ runtime libraries -
multithreaded DLL, multithreaded DLL with debug, multithreaded,
multithreaded with debug, singlethreaded DLL with debug, there are
probabably others both those are the ones I can find mentioned in the
MSDN documentation.

As I understand it, all libraries and applications have to be built
against the same library. Otherwise you get conflicts as you saw in
the first set of link errors - when it was compiled botan was linked
against one set of runtime routines, and then when your application
was a linked a whole set of other routines with conflicting names.

To fix this you need to make sure that both botan and your application
link against the same library. You can do this by compiling them using
the flags documented here:


The warning about dll-interfaces suggests that botan had macros
defined for DLL export (in the file build.h, it is generated by
configure) but you were linking against a non-DLL runtime.


More information about the botan-devel mailing list