【问题标题】:compiling libcurl 7.61.1 from source on Windows 10在 Windows 10 上从源代码编译 libcurl 7.61.1
【发布时间】:2019-06-12 21:18:02
【问题描述】:

我正在处理一个现有的 C++ 项目。我们将 libcurl 作为静态库包含在内,我们从源代码构建。我正在尝试将我们从版本 7.38.0 升级到版本 7.61.1。

我从这里下载了curl-7.61.1.ziphttps://curl.haxx.se/download/

我没有对源代码进行任何修改,也没有运行 curl 7.61.1 附带的任何脚本。

我们有一个用于编译 curl 7.38.0 的现有 VS 解决方案,因此我从该解决方案开始,并根据需要对 curl 7.61.1 中的新文件进行了修改。

一切编译正常,但是,当我尝试将编译结果链接到我的项目时,我收到以下错误:

1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CertOpenStore referenced in function schannel_connect_step1
1>libcurl.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CertCloseStore referenced in function schannel_connect_step1
1>libcurl.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CertFindCertificateInStore referenced in function schannel_connect_step1
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateContext referenced in function pkp_pin_peer_pubkey
1>libcurl.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol  __imp_CryptStringToBinaryA referenced in function schannel_connect_step1
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertAddCertificateContextToStore referenced in function add_certs_to_store
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertGetNameStringA referenced in function verify_host
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CryptQueryObject referenced in function add_certs_to_store
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertCreateCertificateChainEngine referenced in function verify_certificate
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChainEngine referenced in function verify_certificate
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertGetCertificateChain referenced in function verify_certificate
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChain referenced in function verify_certificate
1>C:\Users\CoffeeTableEspresso\project\win64-vs15\debug-mt\executable.exe : fatal error LNK1120: 12 unresolved externals

以前有没有人遇到过类似的问题?如果我还需要使用更多信息进行编辑,请告诉我。

【问题讨论】:

  • 该库现在很可能使用 Windows library 中的函数,而以前没有,因此您必须链接它。旧项目缺少这种依赖关系。
  • 您可能应该确保使用与以前相同的 TLS 后端进行构建,以减少您在升级过程中可能遇到的问题。
  • @DanielStenberg 如果我知道 我们之前是如何构建它的......
  • @PeterA.Schneider 你完全正确,链接到crypt32.lib 为我解决了这个问题

标签: c++ libcurl


【解决方案1】:

正如彼得在评论中提到的,我需要链接到 Windows 库。在这种情况下,链接到 crypt32.lib 为我解决了这个问题。

【讨论】:

    猜你喜欢
    • 2016-11-06
    • 2012-09-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 2017-10-01
    • 2012-03-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多