Using libcurl from NuGet in C++ (VS2013)

霸气de小男生 提交于 2019-12-21 21:21:50

问题


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

回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/21503738/using-libcurl-from-nuget-in-c-vs2013

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