我在运行 Mac OS X 10.7.3 的 MacBook Pro 上从源代码编译了 boost 1.49.0,我使用 Xcode 4.3.2 和 Apple 的 LLVM 3.1 作为我的开发环境。以下代码行(来自 boost http server1 示例)导致链接错误,如下所述:
void Connection::handleRead(const boost::system::error_code& error, size_t bytesTransfered) {
if (!error) {
boost::tribool result;
boost::tie(result, boost::tuples::ignore) = requestParser.parse(request, buffer.data(), buffer.data() + bytesTransfered);
if (result) {
requestHandler.handleRequest(request, reply);
async_write(socket, reply.toBuffers(), boost::bind(&Connection::handleWrite, shared_from_this(), placeholders::error));
}
else if (!result) {
reply = Reply::stockReply(Reply::badRequest);
async_write(socket, reply.toBuffers(), boost::bind(&Connection::handleWrite, shared_from_this(), placeholders::error));
}
else {
socket.async_read_some(boost::asio::buffer(buffer), boost::bind(&Connection::handleRead, shared_from_this(), placeholders::error, placeholders::bytes_transferred));
}
}
else if (error != error::operation_aborted) {
connectionManager.stop(shared_from_this());
}
}
Undefined symbols for architecture x86_64:
"boost::tuples::tuple<boost::logic::tribool, char*, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> RequestParser::parse<char*>(Request&, char*, char*)", referenced from:
Connection::handleRead(boost::system::error_code const&, unsigned long) in Connection.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我搜索了答案,但找不到任何相关内容,我也不明白为什么会发生错误。该项目链接到 lboost_system。我错过了什么吗?我是提升图书馆的新手。