curl-library
Re: compiling against libcurl_a_debug, in a c++ exec VC2013
Date: Tue, 30 Sep 2014 12:38:14 -0700
On 9/30/2014 11:04 AM, Koren Shoval wrote:
> Hi,
>
> i'm not sure if it's a libcurl issue, or my own lack of c++ expertise,
> but i thought i'd ask anyway....
>
> I'm having some issues using libcurl when built with the winbuild
> makefiles
>
> this is what i'm running
>
> ...\curl-7.38.0\winbuild>nmake /f Makefile.vc mode=static VC=12
> WITH_DEVEL=..\external\x86\ WITH_SSL=static WITH_ZLIB=static
> WITH_SSH2=static ENABLE_SSPI=yes ENABLE_IPV6=no ENABLE_IDN=yes
> MACHINE=x86 DEBUG=yes
>
> in ..\external\x86\
>
> i've put all the dependencies
>
> libeay32.lib
> libssh2.lib
> libssh2_a.lib
> libssh2_a_debug.lib
> libssh2_debug.lib
> olber32_a.lib
> olber32_a_debug.lib
> oldap32_a.lib
> oldap32_a_debug.lib
> ssleay32.lib
> zlib.pdb
> zlib_a.lib
>
> (downloaded based on the link in the BUILD.WINDOWS.txt instructions)
>
> though it only uses zlib and ssh2 and i can see the link command is
> using the ssh2_a.lib and not the ssh2_a_debug.lib, also there's no
> zlib_a_debug available
>
> the warning message during linking curl,
>
> LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of
> other libs; use /NODEFAULTLIB:library
>
>
> when i add the libcurl_a_debug.lib i've got and compiling my exec with
> /MTd
> i get:
>
> LNK2005: already defined in libcmtd.lib
>
> and when i ignore /NODEFAULTLIB:libcmtd.lib
>
> i get the error unresolved errors, (i guess it's needed)
> for example:
> error LNK2001: unresolved external symbol __CrtDbgReportW
>
> i'm not a c++ expert, but it seems to me that the compiled lib is
> using the wrong dependencies
> (release instead of debug, for some of the libs) which might cause
> these issues...
>
> BTW,
>
> release mode, works without warnings and i'm able to compile my code
> when ignoring libcmt.lib
>
> any ideas what i can do?
>
Visual Studio does not allow you to mix debuggable code and
non-debuggable code, e.g. /MT and /MTd. The libraries you downloaded
were compiled with /MT, so you cannot link against them if any of your
code is compiled with /MTd. It may be possible now to compile and link
when ignoring libcmt.lib, but you may find later on that other code
requires it.
I finally downloaded the dependencies and created my own makefiles for
them. Because I have my own build script and my own conventions (e.g. I
use static linking for security and the library name is always the same
regardless of compilation flags), they are not compatible with the
shipped versions. I just have to live with that.
I don't have a better answer for you. I've been fighting this problem
for years. This is the way Microsoft has chosen to do things. I could
send you the makefiles I use for curl, zlib and ssh as examples, but you
would be on your own after that.
-- David Chapman dcchapman_at_acm.org Chapman Consulting -- San Jose, CA Software Development Done Right. www.chapman-consulting-sj.com ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2014-09-30