c++ - 如何在ubuntu上编译curlpp?

标签 c++ linux curl compilation

下面是使用curl的简单test.c代码:

#include <stdio.h>
#include <curl/curl.h>
int main(){        
    return 0;
}

为了编译此代码,我使用:

gcc test1.c -lcurl -o test1

对于test1.c,上面的编译是正确的。现在我想使用 C++ 库 (curlpp) 编写一些代码,然后进行编译。

#include <iostream>
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
int main(){
    return 0;
}

为了编译此代码,我尝试了:

g++ test2.cpp -lcurl -o test2

但我收到此错误:

fatal error: curlpp/cURLpp.hpp no such file or directory
compilation terminated.

这个公式不正确。问题是如何编译第二个代码 - test2.cpp?

最佳答案

您很可能忘记安装libcurlpp-dev

您可以通过运行以下命令找出所需的头文件所在的位置:

$ dpkg -S cURLpp.hpp
libcurlpp-dev:amd64: /usr/include/curlpp/cURLpp.hpp

关于c++ - 如何在ubuntu上编译curlpp?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24233138/

相关文章:

c++ - Mac 上的 Eclipse dyld : Library not loaded: Image not found

多维数组结构的C++对齐

sql - fatal error : could not create shared memory segment: Invalid argument

json - 获取 HTTP 状态 400 - 客户端发送的请求在语法上不正确 : using curl to post/put json request

c++ - 在 C++ 中使用 istringstream 读取输入时出错

c++ - 可移植图形API

linux - 如何在捕获输出时在 Crystal 中执行 shell 脚本?

php通过socket编程传递c结构数据

scala - 在scala中执行Curl命令

python - requests.exceptions.SSLError : ("bad handshake: Error([(' SSL routines', 'SSL23_GET_SERVER_HELLO' , 'sslv3 alert handshake failure' )],),)