curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Windows compilation error

From: MATSUDA Daiki via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 3 Jul 2019 09:07:10 +0900

I tried to build curl-7.65.1 on Windows 2008R2 64bit.
The build for library is finished but for curl.exe the warning is displayed
with following.

cd winbuild
nmake /F Makefile.vc mode=static WITH_MBEDTLS=static
MBEDTLS_PATH=..\..\mbedtls-2.7.10\build
...
         link.exe /incremental:no
/libpath:"..\builds\libcurl-vc-x64-release-static-mbedtls-static-ipv6-sspi\lib"
...
MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib'
conflicts with use of other libs; use /NODEFAULTLIB:library

After then, I tried to build other application but error occurs.

V0@@Z) already defined in LIBCMT.lib(typinfo.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _strdup already defined in
LIBCMT.lib(strdup.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _read already defined in
LIBCMT.lib(read.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _write already defined in
LIBCMT.lib(write.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _close already defined in
LIBCMT.lib(close.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _open already defined in
LIBCMT.lib(open.obj)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library
..\..\..\bin\win64\xxx.exe : fatal error LNK1169: one or more multiply
defined symbols found

In my research, the curl library with /MD option in spite of static.

https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=vs-2019

So, I made the patch. With it, for curl.exe no warning is
displayed and other application is built with no error.

Daiki

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2019-07-03