问题
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