如何使用Clang在Windows上正确静态链接libcurl? (64位)

时间:2019-05-30 12:49:38

标签: c++ windows libcurl clang++

最近,由于多种原因,我将Windows从GCC切换到了Clang,我想在一个简单的程序中使用libcurl,但是我觉得没有关于如何为此设置Clang的指南。 我用

clang++ -static -DCURL_STATICLIB curl-7.64.1-win64-mingw/lib/libcurl.a http-post.cpp -std=c++17 -g -Xclang -flto-visibility-public-std -o trading.exe

在VSCode中,我什至不想使用Make或CMake,因为它是简单的程序。

使用该命令,我得到:

libcurl.a(formdata.o) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function Curl_getformdata
libcurl.a(setopt.o) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function vsetopt
libcurl.a(url.o) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function Curl_builtin_scheme
libcurl.a(cookie.o) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function Curl_cookie_init
libcurl.a(mprintf.o) : warning LNK4217: locally defined symbol __acrt_iob_func imported in function dprintf_formatf
libcurl.a(inet_ntop.o) : warning LNK4049: locally defined symbol _errno imported
libcurl.a(strtoofft.o) : warning LNK4049: locally defined symbol _errno imported
libcurl.a(parsedate.o) : warning LNK4049: locally defined symbol _errno imported
libcurl.a(strerror.o) : warning LNK4217: locally defined symbol _errno imported in function Curl_strerror
libcurl.a(asyn-thread.o) : warning LNK4217: locally defined symbol _errno imported in function Curl_resolver_cancel
libcurl.a(connect.o) : warning LNK4217: locally defined symbol _errno imported in function Curl_is_connected
libcurl.a(inet_pton.o) : warning LNK4049: locally defined symbol _errno imported
libcurl.a(strerror.o) : warning LNK4217: locally defined symbol _sys_nerr imported in function Curl_strerror
libcurl.a(hostip.o) : warning LNK4217: locally defined symbol tolower imported in function fetch_addr
libcurl.a(url.o) : warning LNK4217: locally defined symbol tolower imported in function Curl_freeset
libcurl.a(urlapi.o) : warning LNK4217: locally defined symbol tolower imported in function parseurl
libcurl.a(x509asn1.o) : warning LNK4217: locally defined symbol isupper imported in function ASN1tostr
libcurl.a(easy.o) : error LNK2019: unresolved external symbol strdup referenced in function global_init
libcurl.a(easy.o) : error LNK2019: unresolved external symbol libssh2_init referenced in function global_init
libcurl.a(easy.o) : error LNK2019: unresolved external symbol libssh2_exit referenced in function curl_global_cleanup
libcurl.a(system_win32.o) : error LNK2019: unresolved external symbol __imp_WSAStartup referenced in function Curl_win32_init
libcurl.a(telnet.o) : error LNK2001: unresolved external symbol __imp_WSAStartup
libcurl.a(system_win32.o) : error LNK2019: unresolved external symbol __imp_WSACleanup referenced in function Curl_win32_init
libcurl.a(telnet.o) : error LNK2001: unresolved external symbol __imp_WSACleanup
libcurl.a(tftp.o) : error LNK2019: unresolved external symbol __imp_WSAGetLastError referenced in function tftp_disconnect
libcurl.a(openssl.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
libcurl.a(schannel.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
libcurl.a(ftp.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
libcurl.a(telnet.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
libcurl.a(asyn-thread.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
libcurl.a(select.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
libcurl.a(sendf.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
libcurl.a(connect.o) : error LNK2001: unresolved external symbol __imp_WSAGetLastError
libcurl.a(hostip6.o) : error LNK2019: unresolved external symbol __imp_socket referenced in function Curl_ipv6works
libcurl.a(connect.o) : error LNK2001: unresolved external symbol __imp_socket
libcurl.a(select.o) : error LNK2019: unresolved external symbol __imp_WSASetLastError referenced in function Curl_wait_ms
libcurl.a(connect.o) : error LNK2001: unresolved external symbol __imp_WSASetLastError
libcurl.a(curl_addrinfo.o) : error LNK2001: unresolved external symbol __imp_WSASetLastError
libcurl.a(select.o) : error LNK2019: unresolved external symbol __imp_select referenced in function Curl_socket_check
libcurl.a(select.o) : error LNK2019: unresolved external symbol __WSAFDIsSet referenced in function Curl_socket_check
libcurl.a(version.o) : error LNK2019: unresolved external symbol zlibVersion referenced in function curl_version
libcurl.a(content_encoding.o) : error LNK2001: unresolved external symbol zlibVersion
libcurl.a(version.o) : error LNK2019: unresolved external symbol BrotliDecoderVersion referenced in function curl_version
libcurl.a(version.o) : error LNK2019: unresolved external symbol libssh2_version referenced in function curl_version
libcurl.a(tftp.o) : error LNK2019: unresolved external symbol __imp__time64 referenced in function tftp_done
libcurl.a(hostip.o) : error LNK2001: unresolved external symbol __imp__time64
libcurl.a(cookie.o) : error LNK2001: unresolved external symbol __imp__time64
libcurl.a(http.o) : error LNK2001: unresolved external symbol __imp__time64
libcurl.a(ftp.o) : error LNK2001: unresolved external symbol __imp__time64
libcurl.a(rtsp.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(parsedate.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(http.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(ftp.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(telnet.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(imap.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(hostip.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(cookie.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(urlapi.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(http_proxy.o) : error LNK2001: unresolved external symbol sscanf
libcurl.a(sendf.o) : error LNK2019: unresolved external symbol __imp_recv referenced in function Curl_send_plain
libcurl.a(connect.o) : error LNK2001: unresolved external symbol __imp_recv
libcurl.a(openssl.o) : error LNK2001: unresolved external symbol __imp_recv
libcurl.a(sendf.o) : error LNK2019: unresolved external symbol __imp_send referenced in function Curl_send_plain
libcurl.a(telnet.o) : error LNK2001: unresolved external symbol __imp_send
libcurl.a(mime.o) : error LNK2019: unresolved external symbol __imp__stat64 referenced in function curl_mime_data
libcurl.a(mime.o) : error LNK2019: unresolved external symbol access referenced in function curl_mime_data
libcurl.a(ssh.o) : error LNK2001: unresolved external symbol access
libcurl.a(warnless.o) : error LNK2019: unresolved external symbol read referenced in function curlx_read
libcurl.a(warnless.o) : error LNK2019: unresolved external symbol write referenced in function curlx_write
libcurl.a(cookie.o) : error LNK2019: unresolved external symbol ___chkstk_ms referenced in function Curl_cookie_add
libcurl.a(mprintf.o) : error LNK2001: unresolved external symbol ___chkstk_ms
libcurl.a(netrc.o) : error LNK2001: unresolved external symbol ___chkstk_ms
libcurl.a(formdata.o) : error LNK2001: unresolved external symbol ___chkstk_ms
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_getpeername referenced in function Curl_updateconninfo
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_getsockname referenced in function Curl_updateconninfo
libcurl.a(ftp.o) : error LNK2001: unresolved external symbol __imp_getsockname
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_ntohs referenced in function getaddressinfo
libcurl.a(ftp.o) : error LNK2001: unresolved external symbol __imp_ntohs
libcurl.a(socks_sspi.o) : error LNK2001: unresolved external symbol __imp_ntohs
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_getsockopt referenced in function Curl_is_connected
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_closesocket referenced in function Curl_closesocket
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_setsockopt referenced in function Curl_sndbufset
libcurl.a(transfer.o) : error LNK2001: unresolved external symbol __imp_setsockopt
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_WSAIoctl referenced in function Curl_connecthost
libcurl.a(transfer.o) : error LNK2001: unresolved external symbol __imp_WSAIoctl
libcurl.a(telnet.o) : error LNK2001: unresolved external symbol __imp_htons
libcurl.a(smb.o) : error LNK2001: unresolved external symbol __imp_htons
libcurl.a(socks_sspi.o) : error LNK2001: unresolved external symbol __imp_htons
libcurl.a(connect.o) : error LNK2001: unresolved external symbol __imp_htons
libcurl.a(curl_addrinfo.o) : error LNK2001: unresolved external symbol __imp_htons
libcurl.a(doh.o) : error LNK2001: unresolved external symbol __imp_htons
libcurl.a(ftp.o) : error LNK2001: unresolved external symbol __imp_htons
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_bind referenced in function Curl_connecthost
libcurl.a(ftp.o) : error LNK2001: unresolved external symbol __imp_bind
libcurl.a(tftp.o) : error LNK2001: unresolved external symbol __imp_bind
libcurl.a(connect.o) : error LNK2019: unresolved external symbol __imp_connect referenced in function Curl_connecthost
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_version referenced in function Curl_http2_ver
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_submit_rst_stream referenced in function Curl_http2_done
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_send referenced in function Curl_http2_done
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_set_stream_user_data referenced in function Curl_http2_done
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_pack_settings_payload referenced in function Curl_http2_request_upgrade
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_resume_data referenced in function Curl_http2_done_sending
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_mem_recv referenced in function h2_process_pending_input
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_strerror referenced in function h2_process_pending_input
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_priority_spec_init referenced in function h2_process_pending_input
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_submit_priority referenced in function h2_process_pending_input
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_want_read referenced in function h2_process_pending_input
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_want_write referenced in function h2_process_pending_input
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_new referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_send_callback referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_frame_recv_callback referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_data_chunk_recv_callback referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_stream_close_callback referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_begin_headers_callback referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_header_callback referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_error_callback referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_client_new referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_del referenced in function Curl_http2_setup
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_upgrade referenced in function Curl_http2_switched
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_submit_settings referenced in function Curl_http2_switched
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_set_local_window_size referenced in function Curl_http2_switched
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_is_fatal referenced in function Curl_http2_switched
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_submit_request referenced in function http2_send
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_del referenced in function http2_disconnect
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_submit_ping referenced in function http2_conncheck
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_get_stream_user_data referenced in function http2_conncheck
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_session_get_remote_settings referenced in function http2_conncheck
libcurl.a(http2.o) : error LNK2019: unresolved external symbol nghttp2_http2_strerror referenced in function http2_conncheck
libcurl.a(content_encoding.o) : error LNK2019: unresolved external symbol inflateInit_ referenced in function deflate_init_writer
libcurl.a(content_encoding.o) : error LNK2019: unresolved external symbol inflateEnd referenced in function deflate_unencode_write
libcurl.a(content_encoding.o) : error LNK2019: unresolved external symbol inflate referenced in function deflate_close_writer
libcurl.a(content_encoding.o) : error LNK2019: unresolved external symbol inflateInit2_ referenced in function deflate_close_writer
libcurl.a(content_encoding.o) : error LNK2019: unresolved external symbol BrotliDecoderCreateInstance referenced in function brotli_init_writer
libcurl.a(content_encoding.o) : error LNK2019: unresolved external symbol BrotliDecoderDecompressStream referenced in function brotli_unencode_write
libcurl.a(content_encoding.o) : error LNK2019: unresolved external symbol BrotliDecoderDestroyInstance referenced in function brotli_unencode_write
libcurl.a(content_encoding.o) : error LNK2019: unresolved external symbol BrotliDecoderGetErrorCode referenced in function brotli_unencode_write
libcurl.a(mprintf.o) : error LNK2019: unresolved external symbol sprintf referenced in function dprintf_formatf
libcurl.a(md5.o) : error LNK2019: unresolved external symbol MD5_Init referenced in function Curl_md5it
libcurl.a(md5.o) : error LNK2019: unresolved external symbol MD5_Update referenced in function Curl_md5it
libcurl.a(md5.o) : error LNK2019: unresolved external symbol MD5_Final referenced in function Curl_md5it
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol OPENSSL_load_builtin_modules referenced in function Curl_ossl_init
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_load_builtin_engines referenced in function Curl_ossl_init
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol CONF_modules_load_file referenced in function Curl_ossl_init
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol CRYPTO_get_ex_new_index referenced in function Curl_ossl_init
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol OpenSSL_version_num referenced in function Curl_ossl_version
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_shutdown referenced in function Curl_ossl_shutdown
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ERR_clear_error referenced in function Curl_ossl_shutdown
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_read referenced in function Curl_ossl_shutdown
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_get_error referenced in function Curl_ossl_shutdown
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ERR_get_error referenced in function Curl_ossl_shutdown
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ERR_error_string_n referenced in function Curl_ossl_shutdown
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_free referenced in function Curl_ossl_shutdown
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_pending referenced in function Curl_ossl_data_pending
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol RAND_status referenced in function Curl_ossl_random
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol RAND_bytes referenced in function Curl_ossl_random
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_set_connect_state referenced in function Curl_ossl_close
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_free referenced in function Curl_ossl_close
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_finish referenced in function Curl_ossl_close_all
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_free referenced in function Curl_ossl_close_all
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_SESSION_free referenced in function Curl_ossl_session_free
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_by_id referenced in function Curl_ossl_set_engine
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_init referenced in function Curl_ossl_set_engine
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_set_default referenced in function Curl_ossl_set_engine_default
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_get_id referenced in function Curl_ossl_set_engine_default
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_get_first referenced in function Curl_ossl_engines_list
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ENGINE_get_next referenced in function Curl_ossl_engines_list
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_MD_CTX_new referenced in function Curl_ossl_md5sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_md5 referenced in function Curl_ossl_md5sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_DigestInit_ex referenced in function Curl_ossl_md5sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_DigestUpdate referenced in function Curl_ossl_md5sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_DigestFinal_ex referenced in function Curl_ossl_md5sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_MD_CTX_free referenced in function Curl_ossl_md5sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_sha256 referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol RAND_load_file referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol RAND_add referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol RAND_file_name referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_connect referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_version referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_get_current_cipher referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CIPHER_get_name referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_get0_alpn_selected referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_get_verify_result referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_verify_cert_error_string referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol TLS_client_method referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_new referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_ctrl referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_set_msg_callback referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ERR_peek_error referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol BIO_s_mem referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol BIO_new referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_get_peer_cert_chain referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol OPENSSL_sk_num referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol OPENSSL_sk_value referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get_subject_name referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_NAME_print_ex referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol BIO_ctrl referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get_issuer_name referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get_version referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol BIO_printf referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get_serialNumber referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol BIO_puts referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ASN1_STRING_new referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get0_signature referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_signature_print referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ASN1_STRING_free referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol i2a_ASN1_OBJECT referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get0_extensions referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_EXTENSION_get_object referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol i2t_ASN1_OBJECT referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509V3_EXT_print referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_EXTENSION_get_data referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ASN1_STRING_print referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol BIO_free referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get0_notBefore referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ASN1_TIME_print referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get0_notAfter referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get_pubkey referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_PKEY_id referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_PKEY_get0_RSA referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol RSA_get0_key referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol BN_print referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_PKEY_get0_DSA referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol DSA_get0_pqg referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol DSA_get0_key referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_PKEY_get0_DH referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol DH_get0_pqg referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol DH_get0_key referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol EVP_PKEY_free referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol PEM_write_bio_X509 referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_get_peer_certificate referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol X509_get_ext_d2i referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ASN1_STRING_get0_data referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol ASN1_STRING_length referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_set_options referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_set_next_proto_select_cb referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_set_alpn_protos referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_set_default_passwd_cb_userdata referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_set_default_passwd_cb referenced in function Curl_ossl_sha256sum
libcurl.a(openssl.o) : error LNK2019: unresolved external symbol SSL_CTX_use_certificate_file referenced in function Curl_ossl_sha256sum

..

trading.exe : fatal error LNK1120: 376 unresolved externals
clang++: error: linker command failed with exit code 1120 (use -v to see invocation)
The terminal process terminated with exit code: 1

如何正确设置构建命令? 我可以使用比

更整洁的东西吗
-std=c++17 -Xclang -flto-visibility-public-std

使用最新的C ++和STL功能吗?

编辑:根据https://github.com/Microsoft/vcpkg/issues/2621,我需要Ws2_32.Lib,Wldap32.Lib和Crypt32.Lib之类的东西,我对此有所考虑,但是由于我觉得Clang在某种程度上是跨平台的,所以我认为具有自己的二进制文件功能,并且链接这些Windows库并不是很整齐...

EDIT2:尤其是当我链接libcurl时。 a ,而不是.lib。

EDIT3:仍然缺少strdup,即POSIX,所以我不确定是否应该使用链接标志或包含具有该功能定义的文件等...

1 个答案:

答案 0 :(得分:-1)

选项-static意味着产生一个静态库。您显然正在生成一个可执行文件。只需删除该选项,就可以了。同样,您可能必须将cpp文件放在libcurl之前才能满足链接要求。

编辑:我的错。当-static选项同时找到静态和共享时,gcc的{​​{1}}选项使其更喜欢使用静态库。在这里,您将显式链接到静态库。仍然不需要-l选项。

为我服务,是因为它不读取完整的输出。您缺少许多其他依赖项,例如WinSock,C运行时,zlib,ssl。