在 NS-3 中创建对象数组时出错 (C++)

Error while creating array of objects in NS-3 (C++)

本文关键字:出错 C++ 数组 NS-3 创建对象      更新时间:2023-10-16

在 NS-3 .cc文件中,我正在尝试创建 UdpEchoClientHelper 类的实例数组,只需执行以下操作:

UdpEchoClientHelper echoClient[NO_OF_NODES];

当我尝试构建时,我收到错误消息:

../scratch/test.cc:55:33: error: no matching function for call to ‘ns3::UdpEchoClientHelper::UdpEchoClientHelper()’

我在数组声明中做错了什么吗?

没有匹配的构造函数

UdpEchoClientHelper::UdpEchoClientHelper()

这些是可用的构造函数:

   /**
   * Create UdpEchoClientHelper which will make life easier for people trying
   * to set up simulations with echos.
   *
   * param ip The IP address of the remote udp echo server
   * param port The port number of the remote udp echo server
   */
  UdpEchoClientHelper (Address ip, uint16_t port);
  /**
   * Create UdpEchoClientHelper which will make life easier for people trying
   * to set up simulations with echos.
   *
   * param ip The IPv4 address of the remote udp echo server
   * param port The port number of the remote udp echo server
   */
  UdpEchoClientHelper (Ipv4Address ip, uint16_t port);
  /**
   * Create UdpEchoClientHelper which will make life easier for people trying
   * to set up simulations with echos.
   *
   * param ip The IPv6 address of the remote udp echo server
   * param port The port number of the remote udp echo server
   */
  UdpEchoClientHelper (Ipv6Address ip, uint16_t port);

您应该先查看教程。