gpt4 book ai didi

c++ - 如何在 ubuntu 上编译 curlpp?

转载 作者:太空狗 更新时间:2023-10-29 11:44:41 43 4
gpt4 key购买 nike

下面是使用 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?

最佳答案

您很可能忘记安装 libcurlpp-dev

您可以通过运行找到所需的头文件所在的位置:

$ dpkg -S cURLpp.hpp
libcurlpp-dev:amd64: /usr/include/curlpp/cURLpp.hpp

关于c++ - 如何在 ubuntu 上编译 curlpp?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24233138/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com