How to compile curlpp on ubuntu?

限于喜欢 提交于 2020-01-21 16:02:11

问题


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

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

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?


回答1:


You most likely forgot to install 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


来源:https://stackoverflow.com/questions/24233138/how-to-compile-curlpp-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!