Boost突然进入我的命名空间,声称由于缺少函数而出现错误
Boost suddenly getting into my namespace, claiming errors for lack of functions
在传奇故事"Me vs Boost,libconfig,protocol buffers and glog"的新一集中,我们发现我们的主角(我)正在为争夺命名空间的所有权而与Boost进行殊死搏斗!。
嗯,我一直在使用这个漂亮的代码:
server.h
#ifndef SERVER_H
#define SERVER_H 1
#include "configuration.h"
#include "client.h"
#include "client_manager.h"
#include <string>
#include <boost/noncopyable.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
namespace BBCP {
namespace Server {
class Server : private boost::noncopyable {
public:
Server(BBCP::App::Config const &wrapper) :
acceptor(io_service),
wrapper(wrapper)
//signals(io_service),
{ }
void run();
protected:
void acceptHandler(boost::system::error_code const &error);
void startAccept();
void stopServer();
private:
boost::asio::io_service io_service;
boost::asio::ip::tcp::acceptor acceptor;
boost::asio::ip::tcp::endpoint endpoint;
//boost::asio::signal_set signals;
BBCP::Server::client_ptr newClient;
BBCP::Server::ClientManager manager;
boost::thread_group client_pool;
BBCP::App::Config wrapper;
};
}
}
#endif
现在进行了几次构建,并且运行良好,直到之后。。。嗯,什么都没有,它开始出错:
In file included from /usr/include/boost/type_traits/has_nothrow_constructor.hpp:12:0,
from /usr/include/boost/optional/optional.hpp:25,
from /usr/include/boost/optional.hpp:15,
from /usr/include/boost/thread/pthread/thread_data.hpp:13,
from /usr/include/boost/thread/thread.hpp:17,
from /usr/include/boost/thread.hpp:13,
from ../include/server.h:10,
from main.cpp:17:
/usr/include/boost/type_traits/has_trivial_constructor.hpp:36:1: error: ‘has_trivial_ctor_impl’ is not a member of ‘boost::detail’
/usr/include/boost/type_traits/has_trivial_constructor.hpp:36:1: note: suggested alternative:
/usr/include/boost/type_traits/has_trivial_constructor.hpp:25:8: note: ‘BBCP::Server::boost::detail::has_trivial_ctor_impl’
(...) This goes on and on with a lot of dependencies.
现在,从我所看到的,BBCP::Server::boost::detail::has_trivial_ctor_impl
指的是boost::detail
中定义的一些方法。重点是,boost::detail
不应该进入我的命名空间BBCP::Server
!。
老实说,我看不出这个错误是从哪里来的,所以…
任何帮助都将不胜感激!,
朱利安。
可能是您在之前包含的一个标头中的错误,该标头没有正确关闭命名空间。
相关文章:
- 函数中堆分配的效果与缺少堆分配的情况
- c++r值引用应用于函数指针
- 使用基类指针创建对象时,缺少派生类析构函数
- 编译错误:临时对象构造函数中缺少参数
- 构造函数中缺少表达式
- 非void函数可能缺少返回
- 宏函数调用缺少参数警告,即使给定了参数
- 构造函数期望缺少对其他构造函数的调用/候选人期望 1 个参数,提供 0?
- std::vector for_each error C3867函数调用缺少参数列表
- 函数调用缺少参数列表错误
- 错误地将字符串传递给printf样式的日志函数时缺少错误
- 错误 1 错误 C3867:"命令::getSecondWord":函数调用缺少参数列表;使用 '&' 创建指向成员的指针
- 函数调用缺少参数列表警告
- C++对一个对象向量进行排序,得到错误C3867函数调用缺少参数列表
- 当函数末尾缺少返回语句时,为什么它能工作
- 错误C3867:函数调用缺少参数
- C++函数调用缺少参数列表
- 为什么Visual Studio编译器说我的C++函数中缺少分号?
- C++函数调用缺少参数列表;使用 '&Runner::runTask' 创建指向成员的指针
- 函数在类中不起作用-函数调用缺少参数列表