繁体   English   中英

libcurl C ++ curl_easy_init不起作用

[英]libcurl c++ curl_easy_init not working

我只是尝试使用Windows + mingw + eclipse juno + curl 7.29首次设置curl。 我设法使其得以编译和构建。 我为lcurl和lcurldll添加了两个标志。 由于某些原因,以下方法不起作用:

#include <iostream>
#include <curl.h>
using namespace std;

int main(int argc,char *argv[]) {
 cout << "L1" << endl;
 CURL *curl;
 curl = curl_easy_init();
 cout << "L2" << endl;
}

L1和L2均不会打印。 如果我注释掉easy_init行,尽管它运行良好。 我似乎找不到任何类似的帖子,对不起,如果这是骗子。 另外,我一碰到跑步就死不了。 我相信这很明显。

提前致谢。

面向C / C ++开发人员的Eclipse IDE版本:Juno Service Release 1 Build ID:20120920-0800

curl版本:7.29.0-启用了SSL的网址: http ://curl.haxx.se/gknw.net/7.29.0/dist-w32/curl-7.29.0-devel-mingw32.zip

至于mingw不确定我拥有哪个版本,我只是去http://sourceforge.net/projects/mingw/files/并下载/安装了最新版本。

在Eclipse中,在MinGW C ++链接器下,我具有curl和curldll用于库。 在misc中,我具有static标志-这些是我更改的唯一编译器设置。

它确实对我有用,但是由于控制台关闭,我只能在最后添加system("PAUSE") ,然后才能看到任何内容。

这是我的代码:

#include <curl.h>
#include <iostream>

using namespace std;

int main(void)
{
    cout << "L1" << endl;

    CURL *curl;
    curl = curl_easy_init();

    cout << "L2" << endl;

    system("PAUSE");

    return 0;
}

如果您收到消息“无法打开包含文件:'curl.h':没有此类文件或目录”或类似的消息,那是因为您在curl安装过程中错过了某些内容。 我花了很长时间安装它。

暂无
暂无

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

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