cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Linking problem with libcurl and Visual Studio 2005

From: Zachary Page <ZPage_at_nemetschek.net>
Date: Wed, 27 Aug 2008 09:07:42 -0400

Try to define those symbols in debug mode:

 

#if BUG

      _CRTIMP __checkReturn __bcount_opt(_Size) void * __cdecl
_malloc_dbg(

        __in size_t _Size,

        __in int _BlockType,

        __in_z_opt const char * _Filename,

        __in int _LineNumber

            ) {

                  return malloc(_Size);

      }

 

      _CRTIMP void __cdecl _free_dbg(

        __inout_opt void * _Memory,

        __in int _BlockType

            ) {

                  return free(_Memory);

      }

#endif

 

Since it's a debug build, there isn't much risk, so it shouldn't be a
big deal.

 

Zach

 

From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Ashley McConnell
Sent: Tuesday, August 26, 2008 4:42 PM
To: curl-library
Subject: Linking problem with libcurl and Visual Studio 2005

 

Hi Folks,

I have a confusing problem.

I downloaded the latest (at least it was last week) source code
distribution, I have successfully compiled it with both the release and
debug modes (using /MD and MDd respectively).

I have successfully linked and am using the curl lib successfully in
release mode, but when I try to link in debug mode I get linker errors
that seem to suggest that the library was compiled using /MTd code
generation. I have double checked (and rebuilt), but I still can't get
it to work. I have also checked the other libs (it only started when i
added curl).

Here is a sample of the output: -

2>libcmtd.lib(dbgheap.obj) : error LNK2005: _malloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
2>libcmtd.lib(dbgheap.obj) : error LNK2005: _calloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
2>libcmtd.lib(dbgheap.obj) : error LNK2005: _realloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
2>libcmtd.lib(dbgheap.obj) : error LNK2005: _free already defined in
MSVCRTD.lib(MSVCR80D.dll)
2>libcmtd.lib(dbgheap.obj) : error LNK2005: __aligned_malloc already
defined in MSVCRTD.lib(MSVCR80D.dll)
...

Any ideas of what I have done wrong?

Thanks for your help
All the best,
Ash
Received on 2008-08-27