Using libcurl from NuGet in C++ (VS2013)

2020-07-23 08:42发布

First timer here, so I may need a bit of handholding.

I've been trying to just used the simple libcurl examples but am tripping up when compiling. I'm trying to use NuGet and followed what I read in this previous answer

In Project Properties I've linked Additional Library Directories to the folder with libcurl.dll in, and in Linker->Input I've the .lib's listed there in that previous answer. When I try and run it, it gives an error about missing .libs.

1>LINK : fatal error LNK1104: cannot open file 'libeay32.lib' I guess that's not too surprising because the .lib's aren't actually in the folder. When removing references to the .lib's except for libcurl.lib because that is there, I get this error.

1>Source.obj : error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function _main

2条回答
Explosion°爆炸
2楼-- · 2020-07-23 09:16

The OpenSSL NuGet package is currently dated June 12, 2013. The targets files for both openssl.1.0.1.24 and openssl.redist.1.0.1.24 contain the following condition:

$(PlatformToolset.ToLower().IndexOf('v110')) > -1

These preclude compilation and linking because VS2013 sets PlatformToolset = v120 by default. The targets will have to be updated for v120 (and for CTP_Nov2013).

More here on compatibility between RTM and CTP compilers.

查看更多
姐就是有狂的资本
3楼-- · 2020-07-23 09:24

These are OpenSSL functions, which are used by curl. Strange that a package management system like nuget doesn't have automatic dependency tracking. In any case, installing OpenSSL in the same way you installed curl should resolve your issue.

查看更多
登录 后发表回答