How to compile curlpp on ubuntu?

2019-02-26 04:39发布

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条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-26 04:56

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
查看更多
登录 后发表回答