ISO c++禁止声明没有类型的multiset
ISO C++ forbids declaration of ‘multiset’ with no type
我在使用waf构建软件(ns3)时遇到此错误
In file included from ../src/internet-stack/mp-tcp-typedefs.cc:6:
../src/internet-stack/mp-tcp-typedefs.h:151: error: ISO C++ forbids declaration of ‘multiset’ with no type
../src/internet-stack/mp-tcp-typedefs.h:151: error: expected ‘;’ before ‘<’ token
In file included from ../src/internet-stack/mp-tcp-socket-impl.cc:17:
../src/internet-stack/mp-tcp-typedefs.h:151: error: ISO C++ forbids declaration of ‘multiset’ with no type
../src/internet-stack/mp-tcp-typedefs.h:151: error: expected ‘;’ before ‘<’ token
我搜索了错误和解决方案说,可能我在我的c++代码中缺少using namespace std
或#include <set>
,但我的代码并没有缺少这些。错误产生的文件[mp-tcp-typedefs.h]
在这里(第151行有错误)。
我尝试解决错误,但仍然,我得到那些很长一段时间了。
我的gcc/g++版本是g++ (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7.
您不应该将using namespace std;
放在头文件中:
为什么使用命名空间std;"被认为是不好的做法?
你可以通过移动你的using namespace std;
到你自己的命名空间来修改你的代码:
using namespace std;
namespace ns3 {
:
namespace ns3 {
using namespace std;
但最好删除using namespace std;
并用std::
限定所有标准符号,或者在您自己的命名空间中单独声明它们。
namespace ns3 {
using std::string;
using std::list;
using std::multiset;
using std::queue;
相关文章:
- ArduinoJson 6.15.2:JsonObject没有命名类型
- 防止主数据类型C++的隐式转换
- 大量序列中核苷酸类型的快速计数
- 如何从C++中的依赖类型中获得它所依赖的类型
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- 是否可以初始化不可复制类型的成员变量(或基类)
- 如何获取std::result_of函数的返回类型
- 从父命名空间重载类型
- 如果C++类在类方法中具有动态分配,但没有构造函数/析构函数或任何非静态成员,那么它仍然是POD类型吗
- 我想将一个对T类型的非常量左值引用绑定到一个T类型的临时值
- Openssl 1.1.1d无效使用不完整的类型"struct dsa_st"
- 访问者访问变体并返回不同类型时出错
- 在VS2010-VS2015下编译时,如何使用decltype作为较大类型表达式的LHS
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- C++ 雷神库 - 使用资源加载器类时出现问题(不命名类型)
- 模板元程序查找相似的连续类型名称
- 是否可以从int转换为enum类类型
- 构造函数正在调用一个使用当前类类型的函数
- 将引用绑定到类型的值会删除限定符 MULTISET
- ISO c++禁止声明没有类型的multiset