简体   繁体   English

在 Visual Studio 2010 上安装 LibCurl

[英]Installing LibCurl on Visual Studio 2010

I've been having a bit of trouble using LibCurl with Visual Studio 2010. Keep in mind I'm pretty new to C++.我在 Visual Studio 2010 中使用 LibCurl 时遇到了一些麻烦。请记住,我对 C++ 还是很陌生。

I built the library according to the instructions on the libcurl website and tried to point my project to the include directory, libcurl.lib, etc but when I try to build the project I get a bunch of LNK2019 errors.我根据 libcurl 网站上的说明构建了库,并尝试将我的项目指向包含目录、libcurl.lib 等,但是当我尝试构建项目时,我得到了一堆 LNK2019 错误。

Can someone please walk me through how to tell Visual Studio where the include files, .lib file, etc are (ie all the steps after building LibCurl up to using sample code in a test project)?有人可以告诉我如何告诉 Visual Studio 包含文件、.lib 文件等在哪里(即在构建 LibCurl 到在测试项目中使用示例代码之后的所有步骤)?

Thanks in advance.提前致谢。

error LNK2001: unresolved external symbol __imp__send@16错误 LNK2001:未解析的外部符号__imp__send@16

Hurray, we have an error message.万岁,我们有一条错误消息。 Add ws2_32.lib to the Additional Dependencies setting.将 ws2_32.lib 添加到 Additional Dependencies 设置。 The MSDN Library lists the required import library at the bottom of the article for each API function. MSDN 库在文章底部列出了每个 API function 所需的导入库。

Interpreting the linker error is important to diagnose these errors.解释 linker 错误对于诊断这些错误很重要。 Ignore the __imp__ prefix, that's linker glue.忽略__imp__前缀,即 linker 胶水。 You can tell it is trying to find the definition of the send() function.您可以看出它正在尝试查找 send() function 的定义。 That's a standard socket API function.那是标准插座 API function。 The MSDN Library article for send() told me you need to add ws2_32.lib to the dependencies. send() 的 MSDN 库文章告诉我,您需要将 ws2_32.lib 添加到依赖项中。 The article is here , scroll to the bottom.文章在这里,滚动到底部。 This same information should also be available in the library documentation.图书馆文档中也应该提供相同的信息。

open the project settings dialog window first (right click >> properties)首先打开项目设置对话框window(右键>>属性)

this contains everything in regards to getting the project configured这包含有关配置项目的所有内容

find "Linker", then expand it and go to "Linker >> General"找到“链接器”,然后展开它和 go 到“链接器>>常规”

under "Additional library directories" add the location of the ".lib" files在“其他库目录”下添加“.lib”文件的位置

then go to "Linker>>input" and add the name of the library files you want to include然后 go 到“链接器>>输入”并添加要包含的库文件的名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM