bud*_*ath 3 c++ linker libcurl visual-studio-2013
是的,我知道这是libcurl.lib的链接器错误我假设?我尝试从不同的源代码下载libcurl并将其放在不同的地方.
这些是错误:
LibFuckingCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_strerror referenced in function _main
Run Code Online (Sandbox Code Playgroud)
还有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;
}
Run Code Online (Sandbox Code Playgroud)
项目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)
Run Code Online (Sandbox Code Playgroud)
我还尝试将包含在目录和库路径的VC++选项中.我已经阅读了很多指南,帖子,遇到同样问题并且忘记包含libcurl.lib的人
我下载了一个预先构建的libcurl版本,因为CMake昨天差点杀了我.
bud*_*ath 10
使用静态库在Visual Studio 2013上工作
我得到了它,现在,感谢一些天使.发现这个git repo:https://github.com/blackrosezy/build-libcurl-windows
跑.bat也生成静态库,如下载之前的下载.
如何:
运行存储库中包含的.bat.
libcurl将在包含文件夹include和lib的thirdparty子文件夹中找到.
创建一个新的Visual Studio项目
属性 - > VC++ - >添加目录thirdparty/include(路径)
属性 - > 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文件的完整路径)
| 归档时间: |
|
| 查看次数: |
9309 次 |
| 最近记录: |