是的,我知道这是我假设的libcurl.lib的链接器错误?我尝试从其他来源下载libcurl并将其放在不同的位置。
这些是错误:
LibFuckingCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_strerror referenced in function _main
和另外4种相同的
这是示例代码
#include <stdio.h>
#include <curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* example.com is redirected, so we tell libcurl to follow redirection */
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
项目C / C ++的属性常规->其他包含目录-> C:/ Project / libcurl / include
链接程序常规->其他库目录-> C:/ Project / libcurl / lib
输入->其他依赖关系-> libcurl.lib
命令行:在这里我可以读到libcurl.lib被声明
Assuming this structure:
Project
lib
libcurl.dll
libcurl.lib
... dll's
include
curl.h
curlbuild.h
... all the header files
VisualStudio (where VS puts the project)
我还尝试将includes放在VC ++选项中,以用于目录和库路径。我读过许多指南,帖子,遇到相同问题并忘记包含libcurl.lib的人
我下载了libcurl的预构建版本之一,因为CMake昨天差点杀死了我。
使用静态库在Visual Studio 2013上工作
多亏了一些天使,我现在开始工作了。找到了这个git仓库:https : //github.com/blackrosezy/build-libcurl-windows
跑了.bat文件,它也生成了静态库,就像以前没有下载过一样。
如何:
运行存储库中包含的.bat。
libcurl将在包含文件夹include和lib的第三方子文件夹中找到。
创建一个新的Visual Studio项目
属性-> VC ++->添加目录第三方/包含(路径)
属性-> VC ++->添加库thirdparty / lib / static-debug(路径)
属性-> C ++->预处理程序->添加CURL_STATICLIB
链接器->常规->其他库目录库-> thirdparty / lib / static-debug(路径)链接器->输入添加:C:\ xxx \ xxx \ xxx \ build-libcurl-windows \ third-party \ libcurl \ lib \ static-debug \ libcurl_a_debug.lib(lib文件的完整路径)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句