Curlpp遇到的麻烦

时间:2015-11-22 18:03:27

标签: c++ curl libcurl curlpp

当我编译此代码时:

#include <iostream>
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>

int main() {
    cURLpp :: Cleanup cleanup;
    std :: cout << "Hello world" << std :: endl;

    return 0;
}

通过控制台:

g++ main.cpp -lcurlpp

有很多错误,例如:

/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libcurlpp.so: undefined reference to `curl_getenv@CURL_OPENSSL_3'

仅与CURL_OPENSSL_3

相关联

我该如何解决?感谢

Ubuntu 15.04,curl版本 - 7.38.00,curlpp - 已安装sudo apt-get install libcurlpp-dev

1 个答案:

答案 0 :(得分:2)

On Mint 17我能够使用

编译和运行你的程序
g++ main.cpp -lcurl -lcurlpp

查看该程序的库转储,您可能缺少以下可以使用apt-get安装的库:

libssl-1.0.0
libcurl4-openssl-dev

LD Dump

$ ldd a.out 
    linux-vdso.so.1 =>  (0x00007fff701fe000)
    libcurlpp.so.0 => /usr/lib/x86_64-linux-gnu/libcurlpp.so.0 (0x00007f896cd05000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f896c9f7000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f896c7df000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f896c41a000)
    libcurl.so.4 => /usr/lib/x86_64-linux-gnu/libcurl.so.4 (0x00007f896c1b3000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f896beac000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f896cf68000)
    libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007f896bc79000)
    librtmp.so.0 => /usr/lib/x86_64-linux-gnu/librtmp.so.0 (0x00007f896ba5f000)
    libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f896b7ff000)
    libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f896b424000)
    libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f896b1dd000)
    liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f896afcd000)
    libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007f896ad7c000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f896ab63000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f896a944000)
    libgnutls.so.26 => /usr/lib/x86_64-linux-gnu/libgnutls.so.26 (0x00007f896a686000)
    libgcrypt.so.11 => /lib/x86_64-linux-gnu/libgcrypt.so.11 (0x00007f896a406000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f896a201000)
    libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f8969f36000)
    libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f8969d07000)
    libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f8969b02000)
    libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f89698f7000)
    libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f89696dc000)
    libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f89694c0000)
    libgssapi.so.3 => /usr/lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007f8969282000)
    libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f896906e000)
    libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f8968e2b000)
    libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f8968c26000)
    libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f8968a22000)
    libheimntlm.so.0 => /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007f8968818000)
    libkrb5.so.26 => /usr/lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007f8968590000)
    libasn1.so.8 => /usr/lib/x86_64-linux-gnu/libasn1.so.8 (0x00007f89682ee000)
    libhcrypto.so.4 => /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007f89680bb000)
    libroken.so.18 => /usr/lib/x86_64-linux-gnu/libroken.so.18 (0x00007f8967ea6000)
    libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f8967c9d000)
    libwind.so.0 => /usr/lib/x86_64-linux-gnu/libwind.so.0 (0x00007f8967a74000)
    libheimbase.so.1 => /usr/lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007f8967866000)
    libhx509.so.5 => /usr/lib/x86_64-linux-gnu/libhx509.so.5 (0x00007f896761c000)
    libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f8967363000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f896712a000)