To build the program with a static lib, libcurl.lib

北战南征 提交于 2021-02-08 08:14:11

问题


I tried to build a stanalone program with a static lib, libcurl.lib. But I got bunch of errors.

I ever refered to the related posts on stackoverflow and libcurl homepage, unfortunately it is in vain so far.

The following is my building procedure and the error message I got.

Please comments. Thank you a lot,

1. Build curl from source code
    nmake /f Makefile.vc mode=static VC=14  ENABLE_SSPI=no ENABLE_IPV6=no ENABLE_IDN=no GEN_PDB=no DEBUG=no MACHINE=x64

2. Build main.obj CimXml.obj CimCurl.obj getpass.obj
    "cl -I.\include -DCURL_STATICLIB -EHsc -c main.cpp CimXml.cpp CimCurl.cpp getpass.cpp"

3. Build a "STATIC" library cimxml.lib  
    "lib CimXml.obj CimCurl.obj getpass.obj /out:cimxmlcurl.lib"

4. Build the alc.exe
    "cl -DCURL_STATICLIB -I.\include main.obj cimxmlcurl.lib libcurl_a.lib /link /LIBPATH:.\lib /verbose:lib /out:alc.exe"

Error Message:

C:\Users\nick\Documents\sblim-wbemcli-1.6.3-Beta>cl -DCURL_STATICLIB -I.\include main.obj cimxmlcurl .lib libcurl_a.lib /link /LIBPATH:.\lib /verbose:lib /out:alc.exe

Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.00.23026.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe
/LIBPATH:.\lib
/nodefaultlib:MSVCRT.lib
/verbose:lib
/out:alc.exe
main.obj
cimxmlcurl.lib
libcurl_a.lib

Searching libraries
    Searching cimxmlcurl.lib:
    Searching .\lib\libcurl_a.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libcpmt.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\uuid.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\kernel32.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\advapi32.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64\libucrt.lib:
    Searching cimxmlcurl.lib:
    Searching .\lib\libcurl_a.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libcpmt.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\uuid.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\kernel32.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\advapi32.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:

Finished searching libraries

Searching libraries
    Searching cimxmlcurl.lib:
    Searching .\lib\libcurl_a.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libcpmt.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\uuid.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\kernel32.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um\x64\advapi32.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
    Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64\libucrt.lib:

Finished searching libraries
    libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol strdup imported in function curl_easy_init
    OLDNAMES.lib(strdup.obi) : warning LNK4049: locally defined symbol strdup imported
    libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol calloc imported in function curl_easy_init
    libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol free imported in function curl_easy_init
    libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol malloc imported in function curl_easy_init
    libcurl_a.lib(easy.obj) : warning LNK4217: locally defined symbol realloc imported in function curl_easy_init
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strrchr imported
    libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol strrchr imported
    libcurl_a.lib(strerror.obj) : warning LNK4217: locally defined symbol strrchr imported in function Curl_strerror
    libcurl_a.lib(cookie.obj) : warning LNK4049: locally defined symbol strrchr imported
    libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol strrchr imported
    libcurl_a.lib(transfer.obj) : warning LNK4049: locally defined symbol strrchr imported
    libcurl_a.lib(strerror.obj) : warning LNK4217: locally defined symbol strerror imported in function Curl_strerror
    libcurl_a.lib(strerror.obj) : warning LNK4217: locally defined symbol strncpy imported in function Curl_strerror
    libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol strncpy imported
    libcurl_a.lib(telnet.obj) : warning LNK4049: locally defined symbol strncpy imported
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strncpy imported
    libcurl_a.lib(strerror.obj) : warning LNK4217: locally defined symbol __sys_nerr imported in function Curl_strerror
    libcurl_a.lib(pingpong.obj) : warning LNK4049: locally defined symbol memmove imported
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol memmove imported in function sanitize_cookie_path
    libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol memmove imported
    libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol memmove imported
    libcurl_a.lib(imap.obj) : warning LNK4049: locally defined symbol memmove imported
    libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol strchr imported in function Curl_ftp_parselist
    libcurl_a.lib(curl_ntlm_msgs.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(http_digest.obj) : warning LNK4217: locally defined symbol strchr imported in function Curl_output_digest
    libcurl_a.lib(dotdot.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(curl_gethostname.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(ldap.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(file.obj) : warning LNK4217: locally defined symbol strchr imported in function file_do
    libcurl_a.lib(smb.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(pipeline.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(strtok.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(inet_pton.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(dict.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol strchr imported in function Curl_cookie_add
    libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol strchr imported
    libcurl_a.lib(transfer.obj) : warning LNK4217: locally defined symbol strchr imported in function _vsscanf_l
    libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol strncmp imported
    libcurl_a.lib(rtsp.obj) : warning LNK4217: locally defined symbol strncmp imported in function rtsp_do
    libcurl_a.lib(dotdot.obj) : warning LNK4217: locally defined symbol strncmp imported in function Curl_dedotdotify
    libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol strncmp imported in function Curl_ftp_parselist
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol strncmp imported in function Curl_cookie_add
    libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol strncmp imported
    libcurl_a.lib(connect.obj) : warning LNK4217: locally defined symbol strncmp imported in function Curl_sndbufset
    libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol strncmp imported in function curl_mprintf
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function Curl_cookie_init
    libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol __acrt_iob_func imported
    libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function _vsnprintf_l
    libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol __acrt_iob_func imported
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol fclose imported in function Curl_cookie_init
    libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol fclose imported
    libcurl_a.lib(netrc.obj) : warning LNK4049: locally defined symbol fclose imported
    libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol fclose imported
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol fgets imported in function Curl_cookie_init
    libcurl_a.lib(netrc.obj) : warning LNK4049: locally defined symbol fgets imported
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol fopen imported in function Curl_cookie_init
    libcurl_a.lib(netrc.obj) : warning LNK4049: locally defined symbol fopen imported
    libcurl_a.lib(formdata.obj) : warning LNK4049: locally defined symbol fopen imported
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
    libcurl_a.lib(rtsp.obj) : warning LNK4217: locally defined symbol __stdio_common_vsscanf imported in function rtsp_do
    libcurl_a.lib(socks.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
    libcurl_a.lib(http_proxy.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
    libcurl_a.lib(transfer.obj) : warning LNK4217: locally defined symbol __stdio_common_vsscanf imported in function readwrite_data
    libcurl_a.lib(parsedate.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
    libcurl_a.lib(telnet.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
    libcurl_a.lib(imap.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol __stdio_common_vsscanf imported in function _vsscanf_l
    libcurl_a.lib(hostip.obj) : warning LNK4217: locally defined symbol __stdio_common_vsscanf imported in function Curl_global_host_cache_init
    libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
    libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol __stdio_common_vsscanf imported
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol qsort imported in function Curl_cookie_getlist
    libcurl_a.lib(file.obj) : warning LNK4049: locally defined symbol strtoll imported
    libcurl_a.lib(http_proxy.obj) : warning LNK4049: locally defined symbol strtoll imported
    libcurl_a.lib(http_chunks.obj) : warning LNK4217: locally defined symbol strtoll imported in function Curl_chunked_strerror
    libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol strtoll imported in function Curl_ftp_parselist
    libcurl_a.lib(cookie.obj) : warning LNK4217: locally defined symbol strtoll imported in function Curl_cookie_add
    libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol strtoll imported
    libcurl_a.lib(imap.obj) : warning LNK4049: locally defined symbol strtoll imported
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strtoll imported
    libcurl_a.lib(asyn-thread.obj) : warning LNK4217: locally defined symbol _errno imported in function init_resolve_thread
    libcurl_a.lib(http_chunks.obj) : warning LNK4049: locally defined symbol _errno imported
    libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol _errno imported in function Curl_ftp_parselist
    libcurl_a.lib(hostip.obj) : warning LNK4217: locally defined symbol tolower imported in function Curl_cache_addr
    libcurl_a.lib(url.obj) : warning LNK4049: locally defined symbol tolower imported
    libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol isalpha imported in function parse_proxy
    libcurl_a.lib(parsedate.obj) : warning LNK4049: locally defined symbol isalpha imported
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isalpha imported
    libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol isxdigit imported in function parse_proxy
    libcurl_a.lib(escape.obj) : warning LNK4049: locally defined symbol isxdigit imported
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isxdigit imported
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strstr imported
    libcurl_a.lib(curl_sasl.obj) : warning LNK4217: locally defined symbol strstr imported in function Curl_sasl_continue
    libcurl_a.lib(ftplistparser.obj) : warning LNK4049: locally defined symbol strstr imported
    libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol strstr imported in function parse_proxy
    libcurl_a.lib(http.obj) : warning LNK4217: locally defined symbol strstr imported in function Curl_http_readwrite_headers
    libcurl_a.lib(transfer.obj) : warning LNK4049: locally defined symbol strstr imported
    libcurl_a.lib(tftp.obj) : warning LNK4049: locally defined symbol strstr imported
    libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol strpbrk imported in function parseurlandfillconn
    libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol fwrite imported in function Curl_init_userdefined
    libcurl_a.lib(sendf.obj) : warning LNK4049: locally defined symbol fwrite imported
    libcurl_a.lib(tftp.obj) : warning LNK4049: locally defined symbol strtol imported
    libcurl_a.lib(smtp.obj) : warning LNK4049: locally defined symbol strtol imported
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strtol imported
    libcurl_a.lib(ftplistparser.obj) : warning LNK4049: locally defined symbol strtol imported
    libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol strtol imported in function parse_proxy
    libcurl_a.lib(mprintf.obj) : warning LNK4049: locally defined symbol strtol imported
    libcurl_a.lib(pipeline.obj) : warning LNK4217: locally defined symbol strtol imported in function Curl_pipeline_penalized
    libcurl_a.lib(parsedate.obj) : warning LNK4049: locally defined symbol strtol imported
    libcurl_a.lib(url.obj) : warning LNK4217: locally defined symbol strtoul imported in function parseurlandfillconn
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol strtoul imported
    libcurl_a.lib(escape.obj) : warning LNK4049: locally defined symbol strtoul imported
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isdigit imported
    libcurl_a.lib(smtp.obj) : warning LNK4049: locally defined symbol isdigit imported
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol isdigit imported
    libcurl_a.lib(curl_sasl.obj) : warning LNK4049: locally defined symbol isdigit imported
    libcurl_a.lib(ftplistparser.obj) : warning LNK4217: locally defined symbol isdigit imported in function Curl_ftp_parselist
    libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol isdigit imported in function dprintf_DollarString
    libcurl_a.lib(http.obj) : warning LNK4049: locally defined symbol isdigit imported
    libcurl_a.lib(parsedate.obj) : warning LNK4049: locally defined symbol isdigit imported
    libcurl_a.lib(imap.obj) : warning LNK4049: locally defined symbol isdigit imported
    libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol fputc imported in function curl_mfprintf
    libcurl_a.lib(mprintf.obj) : warning LNK4217: locally defined symbol __stdio_common_vsprintf imported in function _vsnprintf_l
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isspace imported
    libcurl_a.lib(http_digest.obj) : warning LNK4049: locally defined symbol isspace imported
    libcurl_a.lib(curl_ntlm.obj) : warning LNK4049: locally defined symbol isspace imported
    libcurl_a.lib(curl_sasl.obj) : warning LNK4217: locally defined symbol isspace imported in function Curl_sasl_continue
    libcurl_a.lib(ftplistparser.obj) : warning LNK4049: locally defined symbol isspace imported
    libcurl_a.lib(http.obj) : warning LNK4217: locally defined symbol isspace imported in function Curl_add_custom_headers
    libcurl_a.lib(ftp.obj) : warning LNK4049: locally defined symbol isspace imported
    libcurl_a.lib(file.obj) : warning LNK4049: locally defined symbol isspace imported
    libcurl_a.lib(rtsp.obj) : warning LNK4049: locally defined symbol isspace imported
    libcurl_a.lib(http.obj) : warning LNK4217: locally defined symbol memchr imported in function Curl_http_readwrite_headers
    libcurl_a.lib(tftp.obj) : warning LNK4217: locally defined symbol memchr imported in function tftp_connect
    libcurl_a.lib(transfer.obj) : warning LNK4217: locally defined symbol fseek imported in function Curl_readrewind
    libcurl_a.lib(progress.obj) : warning LNK4217: locally defined symbol fflush imported in function Curl_pgrsUpdate
    libcurl_a.lib(strequal.obj) : warning LNK4217: locally defined symbol stricmp imported in function curl_strequal
    OLDNAMES.lib(stricmp.obi) : warning LNK4049: locally defined symbol stricmp imported
    libcurl_a.lib(strequal.obj) : warning LNK4217: locally defined symbol strnicmp imported in function curl_strnequal
    OLDNAMES.lib(strnicmp.obi) : warning LNK4049: locally defined symbol strnicmp imported
    libcurl_a.lib(parsedate.obj) : warning LNK4217: locally defined symbol isalnum imported in function parsedate
    libcurl_a.lib(rtsp.obj) : warning LNK4049: locally defined symbol isalnum imported
    libcurl_a.lib(ftplistparser.obj) : warning LNK4049: locally defined symbol isalnum imported
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isalnum imported
    libcurl_a.lib(telnet.obj) : warning LNK4217: locally defined symbol atoi imported in function check_telnet_options
    libcurl_a.lib(file.obj) : warning LNK4217: locally defined symbol _lseeki64 imported in function file_do
    libcurl_a.lib(getenv.obj) : warning LNK4217: locally defined symbol getenv imported in function GetEnv
    libcurl_a.lib(curl_sasl.obj) : warning LNK4217: locally defined symbol isupper imported in function Curl_sasl_decode_mech
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4049: locally defined symbol isupper imported
    libcurl_a.lib(curl_ntlm_core.obj) : warning LNK4217: locally defined symbol toupper imported in function Curl_ntlm_core_mk_ntlmv2_hash
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4217: locally defined symbol islower imported in function loop
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4217: locally defined symbol isprint imported in function loop
    libcurl_a.lib(curl_fnmatch.obj) : warning LNK4217: locally defined symbol isgraph imported in function loop
    OLDNAMES.lib(strdup.obi) : warning LNK4049: locally defined symbol _strdup imported
    OLDNAMES.lib(read.obi) : warning LNK4049: locally defined symbol _read imported
    OLDNAMES.lib(write.obi) : warning LNK4049: locally defined symbol _write imported
    OLDNAMES.lib(stricmp.obi) : warning LNK4049: locally defined symbol _stricmp imported
    OLDNAMES.lib(strnicmp.obi) : warning LNK4049: locally defined symbol _strnicmp imported
    OLDNAMES.lib(close.obi) : warning LNK4049: locally defined symbol _close imported
    OLDNAMES.lib(open.obi) : warning LNK4049: locally defined symbol _open imported
    libcurl_a.lib(cookie.obj) : error LNK2019: unresolved external symbol __imp_fputs referenced in function cookie_output
    libcurl_a.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp__time64
    libcurl_a.lib(curl_ntlm_core.obj) : error LNK2001: unresolved external symbol __imp__time64
    libcurl_a.lib(cookie.obj) : error LNK2001: unresolved external symbol __imp__time64
    libcurl_a.lib(hostip.obj) : error LNK2001: unresolved external symbol __imp__time64
    libcurl_a.lib(http.obj) : error LNK2001: unresolved external symbol __imp__time64
    libcurl_a.lib(tftp.obj) : error LNK2001: unresolved external symbol __imp__time64
    libcurl_a.lib(url.obj) : error LNK2019: unresolved external symbol __imp_fread referenced in function Curl_init_userdefined
    libcurl_a.lib(transfer.obj) : error LNK2001: unresolved external symbol __imp_fread
    libcurl_a.lib(formdata.obj) : error LNK2001: unresolved external symbol __imp_fread
    libcurl_a.lib(warnless.obj) : error LNK2019: unresolved external symbol __imp_read referenced in function curlx_read
    OLDNAMES.lib(read.obi) : error LNK2001: unresolved external symbol __imp_read
    libcurl_a.lib(warnless.obj) : error LNK2019: unresolved external symbol __imp_write referenced in function curlx_write
    OLDNAMES.lib(write.obi) : error LNK2001: unresolved external symbol __imp_write
    libcurl_a.lib(parsedate.obj) : error LNK2019: unresolved external symbol __imp__gmtime64 referenced in function Curl_gmtime
    libcurl_a.lib(curl_threads.obj) : error LNK2019: unresolved external symbol __imp__beginthreadex referenced in function Curl_thread_create
    libcurl_a.lib(file.obj) : error LNK2019: unresolved external symbol __imp_close referenced in function file_done
    OLDNAMES.lib(close.obi) : error LNK2001: unresolved external symbol __imp_close
    libcurl_a.lib(file.obj) : error LNK2019: unresolved external symbol __imp_open referenced in function file_connect
    OLDNAMES.lib(open.obi) : error LNK2001: unresolved external symbol __imp_open
    libcurl_a.lib(file.obj) : error LNK2019: unresolved external symbol __imp__fstat64 referenced in function file_do
    libcurl_a.lib(smb.obj) : error LNK2019: unresolved external symbol __imp__getpid referenced in function smb_format_message
    libcurl_a.lib(formdata.obj) : error LNK2019: unresolved external symbol __imp__stat64 referenced infunction AddFormData
    alc.exe : fatal error LNK1120: 12 unresolved externals

回答1:


I figure it out finally. I have to use:

  • "nmake RTLIBCFG=static /f Makefile.vc mode=static VC=14 ENABLE_IPV6=no ENABLE_IDN=no GEN_PDB=no DEBUG=no MACHINE=x64" in the first step

    and to

  • compile with /MT option for every steps using "cl.exe" like Hans Passant commented.

    Hopefully, this can help out people suffering in the same issue. Bby the way, I found a the website with similar solution as below, http://www.chipkin.com/building-libcurl-on-windows-with-mt-and-mtd/.



来源:https://stackoverflow.com/questions/33734575/to-build-the-program-with-a-static-lib-libcurl-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!