错误:从“ <未解析的重载函数类型>”转换为非标量类型

安尼尔

LSR配置类定义为:

 29 namespace ns3 {
 30 namespace lsr {
 31 
 32 #include <map>
 33 #include <vector>
 34 
 35 class LsrConfig : public Object
 36 {
 37 
 38 public:
 39 
 40   LsrConfig ();
 41   ~LsrConfig ();
 42 
208 };
209
210 }} // namespace lsr,ns3

我正在使用上述类的实例,如下所示。

172   //@@Set configuration.
174   Ptr<lsr::LsrConfig> lsrConfig = CreateObject<lsr::LsrConfig()>;
175   lsrConfig->SetNetworkAttributes (network, site, routerName, logLevel);
176   lsrConfig->SetHelloProtocolAttributes (helloRetries, helloTimeout, helloInterval, adjLsaBuildInterval, firstHelloInterval);

并得到以下编译错误。有人可以解释为什么会出现此错误吗?

../src/lsr-topology-reader.cc: In member function ‘ns3::Ptr<ns3::Node> ns3::LsrTopologyReader::CreateNode(std::string, double, double, std::string, std::string, std::string, std::string, double, double, double, double, double, double, double, std::string, double, double, std::string, double, double, uint32_t)’:
../src/lsr-topology-reader.cc:174:38: error: conversion from ‘<unresolved overloaded function type>’ to non-scalar type ‘ns3::Ptr<ns3::lsr::LsrConfig>’ requested
敬畏的

这只是一个错字:您应该调用方法CreateObject,但是您尝试将类型的对象LsrConfig作为模板参数传递给它,而不是

// Ptr<lsr::LsrConfig> lsrConfig = CreateObject<lsr::LsrConfig()>;
//                                      note the parenthesis  ^^ vv
   Ptr<lsr::LsrConfig> lsrConfig = CreateObject<lsr::LsrConfig  >();

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

错误:类型为'int'和'<未解析的重载函数类型>'的无效操作数为二进制'operator <<'

为什么ISO C禁止将非标量转换为相同类型

类型错误:只能将长度为1的数组转换为Python标量

复制初始化-从'int'转换为非标量类型

如何解决此错误“从const_iterator转换为非标量类型”?

从指针转换为非标量对象类型?

我该如何解决错误:请求从“ void”转换为非标量类型“ std :: vector <int>”

如何通过对非标量值求和将不同类型的字典转换为熊猫系列?

错误:从std :: chrono :: time_point浮点数转换为非标量类型long int

向矢量对象请求转换为非标量类型

如何将结构转换为uint8_t(错误:请求转换为非标量类型)

请求从lambda转换为非标量类型

从请求到非标量类型的转换(功能)

转换为非标量类型

错误:请求从'int'转换为非标量类型'BIGNUM {aka bignum_st}'

请求从'std :: vector <AdjacencyData>(*)()'转换为非标量类型'std :: vector <AdjacencyData>'

错误:从'QFont'转换为非标量类型'QFontMetricsF'的请求-Qt

C ++错误:是否要求转换为非标量类型?

boost :: thread_group :: create_thread(<未解析的重载函数类型>错误

从'int'转换为非标量类型赋值运算符-将对象转换为int

转换为非标量类型

为什么编译失败并出现错误:已请求转换为非标量类型

Python:类型错误:只能将长度为 1 的数组转换为 Python 标量

错误:类型错误:只有长度为 1 的数组可以转换为 Python 标量

类型错误:只有大小为 1 的数组可以转换为 Python 标量 - 地球观测

类型错误:只有大小为 1 的数组可以转换为 Python 标量以用于加密数据

错误:请求从“const char”转换为非标量类型“std::string”{aka 'std::__cxx11::basic_string<char>'}

如何解决此类型错误:只有整数标量数组可以转换为标量索引

错误:没有匹配的函数调用'sf::RenderWindow::draw(<未解析的重载函数类型>)'| C++ 中的 SFML