【问题标题】:Linking Curl to Codeblocks on Windows在 Windows 上将 Curl 链接到代码块
【发布时间】:2015-12-05 08:30:53
【问题描述】:

我用的是Win7x64,下载了libCurl

我在 build options->linker-settings

中将库 *.a 文件从 curl/lib64 添加到我的项目中

添加到搜索目录 ->compiler /curl/include 目录。 我正在尝试编译示例代码:

#include <stdio.h>
#include <curl\curl.h>

int main(void)
{
curl_global_init( CURL_GLOBAL_ALL );
 CURL * myHandle;
 CURLcode result;
 myHandle = curl_easy_init ( ) ;

 curl_easy_setopt(myHandle, CURLOPT_URL, "http://www.example.com");
 result = curl_easy_perform( myHandle );
 curl_easy_cleanup( myHandle );
 printf("LibCurl rules!\n");

 return 0;
}

我得到了错误:

*||=== 构建:在测试中调试(编译器:GNU GCC 编译器)===| obj\Debug\main.o||在函数main':| D:\Projects\test\main.cpp|6|未定义的引用 _imp__curl_global_init'| D:\Projects\test\main.cpp|9|未定义 引用 _imp__curl_easy_init'| D:\Projects\test\main.cpp|11|未定义的引用 _imp__curl_easy_setopt'| D:\Projects\test\main.cpp|12|未定义 参考 _imp__curl_easy_perform'| D:\Projects\test\main.cpp|13|未定义的引用 _imp__curl_easy_cleanup'| ||=== 构建失败:5 个错误,0 警告(0 分钟,0 秒)===|*

我不知道我应该怎么做才能让它工作。

【问题讨论】:

    标签: c++ curl linker codeblocks libcurl


    【解决方案1】:

    好的,根据阅读另一篇文章,我尝试链接 32x lib,瞧,它可以工作了。

    【讨论】:

    • 你应该给链接或者应该写更多
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-27
    • 1970-01-01
    • 1970-01-01
    • 2015-05-16
    • 1970-01-01
    • 1970-01-01
    • 2021-06-07
    相关资源
    最近更新 更多