cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: error LNK2005 - already defined stuff...

From: Ernie Johansen <johansen_at_gazebo.com>
Date: Wed, 25 Sep 2002 17:25:25 -0700

I ran into the same problem yesterday but the problem was a big for me since
my app was using freeware libraries from 3 different vendors. I ended up
rebuilding them all in Release mode with the /MD compiler option to get rid
of this problem. Using /NODEFAULTLIB was not an option since the other
libraries needed the default libs. I could have used /MDd but you have to
be consistent across the board.
  -----Original Message-----
  From: curl-library-admin_at_lists.sourceforge.net
[mailto:curl-library-admin_at_lists.sourceforge.net]On Behalf Of Chris Russell
  Sent: Wednesday, September 25, 2002 7:22 AM
  To: curl-library_at_lists.sourceforge.net
  Subject: Re: error LNK2005 - already defined stuff...

  You're right about it being a settings problem. Here you have two (or
possibly more) chunks of code you're attempting to link that have
inconsistent dependencies on the C run time library. Note that there are a)
LIB b) DLL versions of the CRT and they come in c) Release d) Debug
versions. This is a debug build (note the trailing D). BUT, one chunk of
code is importing symbols from the DLL CRT and the other from the LIB CRT.
Thus the symbol redundancy. Use one or the other but not both and your
application should link.
    ----- Original Message -----
    From: Ben Helleman
    To: 'curl-library_at_lists.sourceforge.net'
    Sent: Wednesday, September 25, 2002 9:39 AM
    Subject: error LNK2005 - already defined stuff...

    Does this look familar to anyone using MV6++:

    SVCRTD.lib(MSVCRTD.dll) : error LNK2005: _free already defined in
LIBCD.lib(dbgheap.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _malloc already defined in
LIBCD.lib(dbgheap.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _realloc already defined in
LIBCD.lib(dbgheap.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strncpy already defined in
LIBCD.lib(strncpy.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fwrite already defined in
LIBCD.lib(fwrite.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strtoul already defined in
LIBCD.lib(strtol.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strstr already defined in
LIBCD.lib(strstr.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __isctype already defined in
LIBCD.lib(isctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _toupper already defined in
LIBCD.lib(toupper.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _tolower already defined in
LIBCD.lib(tolower.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strchr already defined in
LIBCD.lib(strchr.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fclose already defined in
LIBCD.lib(fclose.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fprintf already defined in
LIBCD.lib(fprintf.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _sprintf already defined in
LIBCD.lib(sprintf.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strtol already defined in
LIBCD.lib(strtol.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fputc already defined in
LIBCD.lib(fputc.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _printf already defined in
LIBCD.lib(printf.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fflush already defined in
LIBCD.lib(fflush.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strncmp already defined in
LIBCD.lib(strncmp.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __close already defined in
LIBCD.lib(close.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __read already defined in
LIBCD.lib(read.obj)
    LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other
libs; use /NODEFAULTLIB:library
    Debug/PA_Server_Agent.exe : fatal error LNK1169: one or more multiply
defined symbols found
    Error executing link.exe.

    I've done the following :

    my preprocessor settings are :
            WIN32,_DEBUG,_CONSOLE,_MBCS,NODEFAULTLIB:library

    my link object/library modules are:
            winmm.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uu
id.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
uuid.lib odbc32.lib odbccp32.lib

    In my project I've encluded libcurl.lib

    For some reason I think it has to do with the run time library's and
mucking around with debug and release version, under C/C++ tab -> Code
Generation -> Use Run-Time Library -> ????

    Tell me if I'm way off here but maybe someone has already delt with this
issue and can save me a lot of time :)

    Thanks
    Ben

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-09-26