gpt4 book ai didi

c++ - OSX 10.8.2 上的 Poco C++ 库 : Undefined symbols for architecture x86_64

转载 作者:可可西里 更新时间:2023-11-01 17:03:14 52 4
gpt4 key购买 nike

我正在尝试使用 Poco C++ 库,用于在 Mac OS X 10.8.2 上使用 C++ 执行简单的 http 请求。我安装了 Poco,从 this tutorial 复制粘贴了 http_request.cc 代码, 用 'g++ -o http_get http_get.cc -lPocoNet' 运行它,但得到:

Undefined symbols for architecture x86_64:
"Poco::StreamCopier::copyStream(std::basic_istream<char, std::char_traits<char> >&, std::basic_ostream<char, std::char_traits<char> >&, unsigned long)", referenced from:
_main in ccKuZb1g.o
"Poco::URI::URI(char const*)", referenced from:
_main in ccKuZb1g.o
"Poco::URI::~URI()", referenced from:
_main in ccKuZb1g.o
"Poco::URI::getPathAndQuery() const", referenced from:
_main in ccKuZb1g.o
"Poco::URI::getPort() const", referenced from:
_main in ccKuZb1g.o
"Poco::Exception::displayText() const", referenced from:
_main in ccKuZb1g.o
"typeinfo for Poco::Exception", referenced from:
GCC_except_table1 in ccKuZb1g.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

已经为此苦苦挣扎了几个小时。知道如何解决这个问题吗?提前致谢!

最佳答案

Poco::URIPoco::StreamCopier 类位于 PocoFoundation 库中,因此您需要链接到该库还有。

g++ -o http_get http_get.cc -lPocoNet -lPocoFoundation

关于c++ - OSX 10.8.2 上的 Poco C++ 库 : Undefined symbols for architecture x86_64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12924673/

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