[英]cURL with Visual Studio 2013
So i have came along with cURL as a very nice library and working very fine in OSX. 所以我和cURL一起作为一个非常好的库而且在OSX中运行得非常好。 But on windows now i have got big troubles with getting ready with this library.
但是现在在Windows上我已经为这个库做好了准备。 I googled now for about 2 days and tried over a dozen (in detail) different ways to get this ready.
我现在用Google搜索了大约2天,并尝试了十几种(详细的)不同的方法来做好准备。 Without any success at all.
没有任何成功。
Here are some ways I basically tried: 以下是我基本上尝试过的一些方法:
Successfully added 'curl 7.30.0.2' to test.
Successfully added 'curl 7.30.0.2' to test.
it also seemed nice, but compiling simple.c
leads to a bunch of unresolved external symbol
linker errors. simple.c
会导致一堆unresolved external symbol
链接器错误。 But a solution is provided: Project > Properties > VC++ Properties > "Include Directories"
and Project > Properties > VC++ Properties > "Include Directories"
和 Project > Properties > VC++ Properties > "Library Directories"
Project > C/C++ > General > "Additional Include Directories"
and in Project > Linker > General > "Additional Library Directories"
I desperately added the \\packages\\ path from my project folder. Project > C/C++ > General > "Additional Include Directories"
和Project > Linker > General > "Additional Library Directories"
我拼命地从我的项目文件夹中添加了\\ packages \\ path。 libcurl.lib;libeay32.lib;ssleay32.lib;Ws2_32.lib;libssh2.lib;zlib.lib;wldap32.lib;
libcurl.lib;libeay32.lib;ssleay32.lib;Ws2_32.lib;libssh2.lib;zlib.lib;wldap32.lib;
to Project > Linker > Input > "Additional Dependencies"
. Project > Linker > Input > "Additional Dependencies"
。 unresolved external symbol
errors are gone! unresolved external symbol
错误都消失了! Therefore I get just one error saying cannot open file 'libcurl.lib'
. cannot open file 'libcurl.lib'
。 What can I do here? I am pretty new to all that. 我对这一切都很陌生。 But I am trying really hard now to get this finally to work.
但是我现在正在努力让这个最终发挥作用。 So what can I do?
那我该怎么办?
I work with Visual Studio 2013 Community Edition. 我使用Visual Studio 2013社区版。 The currently most recent version of cURL is
7.42.1
. 目前最新版本的cURL是
7.42.1
。 Any help is highly welcome! 非常欢迎任何帮助!
Had problems myself, finally got it working now. 我自己有问题,现在终于搞定了。 I downloaded curl-7.42.1.zip from the official website .
我从官方网站上下载了curl-7.42.1.zip 。 Within the archive you'll find the source code and winbuild/BUILD.WINDOWS.txt, which basically contains the instructions I followed.
在存档中,您将找到源代码和winbuild / BUILD.WINDOWS.txt,它基本上包含我遵循的说明。 I'll assume that it has been unzipped to C:\\curl-7.42.1.
我假设它已被解压缩到C:\\ curl-7.42.1。
Open the Visual Studio command prompt located at 打开位于的Visual Studio命令提示符
C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\Shortcuts
C:\\ Program Files(x86)\\ Microsoft Visual Studio 12.0 \\ Common7 \\ Tools \\ Shortcuts
This automatically sets the environment variables needed to use Visual Studio tools like the compiler. 这会自动设置使用Visual Studio工具(如编译器)所需的环境变量。 Then move to the winbuild directory and call
然后转到winbuild目录并调用
nmake /f Makefile.vc mode=dll
nmake / f Makefile.vc mode = dll
as described in the text file I mentioned above. 如上面提到的文本文件中所述。
That will create the directory 那将创建目录
C:\\curl-7.42.1\\builds\\libcurl-vc-x86-release-dll-ipv6-sspi-winssl
C:\\卷曲-7.42.1 \\建立\\ libcurl中,VC-x86的版本的DLL-IPv6的SSPI-winssl
containing libcurl.dll, libcurl.lib and the necessary header files. 包含libcurl.dll,libcurl.lib和必要的头文件。 Let's rename it to
C:\\curl-7.42.1\\builds\\release
:'D 让它重命名为
C:\\curl-7.42.1\\builds\\release
:'D
VC++ Directories > Include directories
and add C:\\curl-7.42.1\\builds\\release\\include
VC++ Directories > Include directories
然后添加C:\\curl-7.42.1\\builds\\release\\include
C:\\curl-7.42.1\\builds\\release\\lib
to VC++ Directories > Library directories
. C:\\curl-7.42.1\\builds\\release\\lib
到VC++ Directories > Library directories
。 Linker > Input > Additional Dependencies
and add libcurl.lib
. Linker > Input > Additional Dependencies
并添加libcurl.lib
。 C:\\curl-7.42.1\\builds\\release\\bin\\libcurl.dll
to your project folder. C:\\curl-7.42.1\\builds\\release\\bin\\libcurl.dll
复制到项目文件夹中。 That should do the trick! 这应该够了吧! :D If you want to use cURL in debug mode, you can do almost the same, recompile using
nmake /f Makefile.vc mode=dll debug=yes
, go to your project's properties, add the newly created directory paths (changing libcurl.lib to libcurl_debug.lib) and you should be done. :D如果你想在调试模式下使用cURL,你可以做几乎相同,使用
nmake /f Makefile.vc mode=dll debug=yes
重新编译nmake /f Makefile.vc mode=dll debug=yes
,转到项目的属性,添加新创建的目录路径(更改libcurl。 lib到libcurl_debug.lib)你应该完成。
I had the same issue. 我遇到过同样的问题。 I downloaded the curl from https://github.com/curl/curl .
我从https://github.com/curl/curl下载了curl。 you can actually compile it directly with Visual Studio 2013 (but be careful with parameters setting: x64 with release).
您可以使用Visual Studio 2013直接编译它(但请注意参数设置:x64 with release)。 The major difference is that it gives you libcurl_imp.lib.
主要区别在于它为您提供了libcurl_imp.lib。 Then all you have to do is to set the environment variables as described above.
然后,您所要做的就是如上所述设置环境变量。 Just want to mention, you will have to use libcurl_imp.lib rather than libcurl.lib in the additional dependencies (I suspect this change is because of the new version of curl).
只是想提一下,你将不得不在其他依赖项中使用libcurl_imp.lib而不是libcurl.lib(我怀疑这个更改是因为curl的新版本)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.