[Botan-devel] Tons of linker errors with MFC...

Jack Lloyd lloyd at randombit.net
Thu Dec 6 15:18:00 EST 2007


On Thu, Dec 06, 2007 at 02:47:17PM -0500, Helms, Jim wrote:
> Hi,
> 
>  
> 
> I'm working with Botan in an MFC application under VC 7.1 and am getting
> tons of linker errors.  I wrote a separate console application with the
> same build of Botan and it worked fine.  Are there conflicts between
> Botan and MFC?  Here are the errors:
> 
>  
> 
> KeyFileGenerator4000 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(pipe.obj)
[...]
> KeyFileGenerator4000 warning LNK4098: defaultlib 'msvcrtd.lib' conflicts
> with use of other libs; use /NODEFAULTLIB:library
> 
> KeyFileGenerator4000 warning LNK4098: defaultlib 'LIBC' conflicts with
> use of other libs; use /NODEFAULTLIB:library

There is not (to my knowledge!) any intrinsic incompatability between
Botan and another other library. What this looks like to me (and I'm
not really a Windows programmer at all, but this looks familiar) is
that the library (libbotan.lib) was compiled against a different C
runtime than everything else. IIRC, Windows has four (thread-safe vs
not, debug vs not), and everything in a program has to be compiled
against the same library.

MSDN has information about the various flags to cl.exe that affect
this:
   http://msdn2.microsoft.com/en-us/library/2kzt1wy3(VS.80).aspx

Probably what you want to do is figure out which C library MFC wants
to link against in your project, and rebuild Botan with the
appropriate flag so it also uses that C library.

-Jack



More information about the botan-devel mailing list