如何在Ubuntu上编译curlpp? [英] How to compile curlpp on ubuntu?
本文介绍了如何在Ubuntu上编译curlpp?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是一个使用curl的简单test.c代码:
Below is a simple test.c code using curl:
#include <stdio.h>
#include <curl/curl.h>
int main(){
return 0;
}
要编译此代码,我使用:
To compile this code I use:
gcc test1.c -lcurl -o test1
对于上面的test1.c编译是正确的。现在我想使用C ++ libs(curlpp)编写一些代码,然后编译它。
For test1.c above compilation is correct. Now I would like to write some code using C++ libs (curlpp) and after that compile it.
#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
但我得到这个错误:
fatal error: curlpp/cURLpp.hpp no such file or directory
compilation terminated.
此公式不正确。问题是如何编译第二个代码 - test2.cpp?
This formula is not correct. The question is how to compile second code - test2.cpp?
推荐答案
你很可能忘了安装 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
这篇关于如何在Ubuntu上编译curlpp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文