gpt4 book ai didi

c++ - 在 Windows 上使用 curlpp。如何开始

转载 作者:行者123 更新时间:2023-11-30 04:30:46 26 4
gpt4 key购买 nike

我是 C++ 的新手,我正在使用 mingw 编译器。最后一行

#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
....
string url ("http://www.google.com");
curlpp::Cleanup myCleanup;
curlpp::options::Url myUrl(url);

编译时抛出如下长错误

C:\Users\UserName\AppData\Local\Temp\ccpkmZ1C.o:test.cpp:(.text$_ZN6curlpp11Option
TraitISsL10CURLoption10002EED1Ev[curlpp::OptionTrait<std::basic_string<char, std
::char_traits<char>, std::allocator<char> >, (CURLoption)10002>::~OptionTrait()]
+0xb): undefined reference to `_imp___ZTVN6curlpp11OptionTraitISsL10CURLoption10
002EEE'
...
...

这是怎么回事?除了从 curlpp 和 libcurl 复制包含文件夹以使用 curlpp 之外,我还需要做更多的事情吗?

提前致谢!

最佳答案

这是一个链接器错误。

您需要将 libcurl 库添加到构建命令中。像这样的东西:

g++ test.cpp -o test -llibcurlpp

我不确定 libcurl 库的确切名称。

关于c++ - 在 Windows 上使用 curlpp。如何开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8475031/

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