Poco C++;OSX 10.8.2上的库:架构x86_64的未定义符号 我尝试使用C++库在C++操作系统上对C++操作系统中的简单HTTP请求进行操作。我安装了Poco,从中复制粘贴了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 架构x86_64的未定义符号: “Poco::StreamCopier::copyStream(std::basic_istream&,std::basic_ostream&,无符号长)”引用自: _ccKuZb1g.o中的主管道 “Poco::URI::URI(char const*)”,引用自: _ccKuZb1g.o中的主管道 “Poco::URI::~URI()”,引用自: _ccKuZb1g.o中的主管道 “Poco::URI::getPathAndQuery()常量”,引用自: _ccKuZb1g.o中的主管道 “Poco::URI::getPort()常量”,引用自: _ccKuZb1g.o中的主管道 “Poco::Exception::displayText()const”,引用自: _ccKuZb1g.o中的主管道 “Poco的typeinfo::Exception”,引用自: 除ccKuZb1g.o表1外的GCC ld:找不到架构x86_64的符号 collect2:ld返回了1个退出状态
我已经为此挣扎了几个小时。你知道怎么解决这个问题吗?提前谢谢 您似乎没有指定编译源代码时要使用的库和库的包含路径。Poco C++;OSX 10.8.2上的库:架构x86_64的未定义符号 我尝试使用C++库在C++操作系统上对C++操作系统中的简单HTTP请求进行操作。我安装了Poco,从中复制粘贴了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 架构x86_64的未定义符号: “Poco::StreamCopier::copyStream(std::basic_istream&,std::basic_ostream&,无符号长)”引用自: _ccKuZb1g.o中的主管道 “Poco::URI::URI(char const*)”,引用自: _ccKuZb1g.o中的主管道 “Poco::URI::~URI()”,引用自: _ccKuZb1g.o中的主管道 “Poco::URI::getPathAndQuery()常量”,引用自: _ccKuZb1g.o中的主管道 “Poco::URI::getPort()常量”,引用自: _ccKuZb1g.o中的主管道 “Poco::Exception::displayText()const”,引用自: _ccKuZb1g.o中的主管道 “Poco的typeinfo::Exception”,引用自: 除ccKuZb1g.o表1外的GCC ld:找不到架构x86_64的符号 collect2:ld返回了1个退出状态,c++,macos,http,linker,x86-64,C++,Macos,Http,Linker,X86 64,我已经为此挣扎了几个小时。你知道怎么解决这个问题吗?提前谢谢 您似乎没有指定编译源代码时要使用的库和库的包含路径。 您需要向g++提供-I和-L指令,分别指定库和库本身的包含路径。Poco::URI,Poco::StreamCopier类位于PocoFoundation库中,因此您还需要链接到该库 g++ -o http_get http_get.cc -lPocoNet -lPocoFoundation 这看起来好像需要包含一些库,例如,-lPocoNet(不过我猜库的名称)。
您需要向g++提供-I和-L指令,分别指定库和库本身的包含路径。Poco::URI,
Poco::StreamCopier
类位于PocoFoundation
库中,因此您还需要链接到该库
g++ -o http_get http_get.cc -lPocoNet -lPocoFoundation
这看起来好像需要包含一些库,例如,
-lPocoNet
(不过我猜库的名称)。