下面是一个使用curl的简单test.c代码:
#include <stdio.h>
#include <curl/curl.h>
int main(){
return 0;
}为了编译这段代码,我使用:
gcc test1.c -lcurl -o test1对于上面的test1.c,编译是正确的。现在,我想使用C++库(curlpp)编写一些代码,然后编译它。
#include <iostream>
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
int main(){
return 0;
}为了编译这段代码,我尝试了:
g++ test2.cpp -lcurl -o test2但是我得到了这个错误:
fatal error: curlpp/cURLpp.hpp no such file or directory
compilation terminated.这个公式不正确。问题是如何编译第二个代码- test2.cpp?
发布于 2014-06-16 06:05:38
您很可能忘记了安装libcurlpp-dev。
您可以通过运行以下命令找出所需的头文件的位置:
$ dpkg -S cURLpp.hpp
libcurlpp-dev:amd64: /usr/include/curlpp/cURLpp.hpphttps://stackoverflow.com/questions/24233138
复制相似问题