在 Visual Studio 2010 上安装 LibCurl
我在 Visual Studio 2010 中使用 LibCurl 时遇到了一些问题。请记住,我对 C++ 还很陌生。
我根据 libcurl 网站上的说明构建了库,并尝试将我的项目指向包含目录、libcurl.lib 等,但当我尝试构建项目时,出现了一堆 LNK2019 错误。
有人可以指导我如何告诉 Visual Studio 包含文件、.lib 文件等在哪里(即构建 LibCurl 到在测试项目中使用示例代码之后的所有步骤)吗?
提前致谢。
I've been having a bit of trouble using LibCurl with Visual Studio 2010. Keep in mind I'm pretty new to 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.
Can someone please walk me through how to tell Visual Studio where the include files, .lib file, etc are (i.e. all the steps after building LibCurl up to using sample code in a test project)?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好啦,我们有一条错误消息。将 ws2_32.lib 添加到“附加依赖项”设置。 MSDN Library 在文章底部列出了每个 API 函数所需的导入库。
解释链接器错误对于诊断这些错误非常重要。忽略
__imp__
前缀,它是链接器胶水。您可以看出它正在尝试查找 send() 函数的定义。这是一个标准的套接字 API 函数。 send() 的 MSDN 库文章告诉我您需要将 ws2_32.lib 添加到依赖项中。文章在这里,滚动到底部。库文档中也应该提供相同的信息。Hurray, we have an error message. Add ws2_32.lib to the Additional Dependencies setting. The MSDN Library lists the required import library at the bottom of the article for each API function.
Interpreting the linker error is important to diagnose these errors. Ignore the
__imp__
prefix, that's linker glue. You can tell it is trying to find the definition of the send() function. That's a standard socket API function. The MSDN Library article for send() told me you need to add ws2_32.lib to the dependencies. The article is here, scroll to the bottom. This same information should also be available in the library documentation.首先打开项目设置对话框窗口(右键单击>>属性),
其中包含与配置项目有关的所有内容,
“链接器>>常规”
找到“链接器”,然后将其展开并转到“附加库目录”下的 添加“.lib”文件的位置
,然后转到“链接器>>输入”并添加要包含的库文件的名称
open the project settings dialog window first (right click >> properties)
this contains everything in regards to getting the project configured
find "Linker", then expand it and go to "Linker >> General"
under "Additional library directories" add the location of the ".lib" files
then go to "Linker>>input" and add the name of the library files you want to include