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

时间:2015-03-09 21:59:18

标签: c++ arrays ns-3

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

UdpEchoClientHelper echoClient[NO_OF_NODES];

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

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

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

1 个答案:

答案 0 :(得分:1)

没有匹配的构造函数
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);

你应该先看一下教程。