简体   繁体   English

如何在Ubuntu上编译curlpp?

[英]How to compile curlpp on ubuntu?

Below is a simple test.c code using curl: 以下是使用curl的简单test.c代码:

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

To compile this code I use: 要编译此代码,我使用:

gcc test1.c -lcurl -o test1

For test1.c above compilation is correct. 对于上述test1.c,编译正确。 Now I would like to write some code using C++ libs (curlpp) and after that compile it. 现在,我想使用C ++库(curlpp)编写一些代码,然后对其进行编译。

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

To compile this code I tried: 为了编译这段代码,我尝试过:

g++ test2.cpp -lcurl -o test2

But I get this error: 但是我得到这个错误:

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

This formula is not correct. 此公式不正确。 The question is how to compile second code - test2.cpp? 问题是如何编译第二个代码-test2.cpp?

You most likely forgot to install libcurlpp-dev . 您最有可能忘记安装libcurlpp-dev

You can find out where the required header files are located by running: 您可以通过运行以下命令找到所需的头文件所在的位置:

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

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

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