-2
#include "connection.h"


 ConnectionType[] ConnectionArray = new ConnectionType[NUMBER_OF_CONNECTIONS];

我收到 2 个错误

  1. 错误:需要一个标识符
  2. 错误:应为“;”

我有

class ConnectionType {
public:
  Ptr<Socket> txMstrSocPtr; /// Pointer to Master tx socket
  Ptr<Socket> rxMstrSocPtr; /// Pointer to Master rx socket
  Ptr<Socket> txSlavSocPtr; /// Pointer to Slave tx socket
  Ptr<Socket> rxSlavSocPtr; /// Pointer to Slave rx socket

  //ConnectionType();
  //~ConnectionType();

  void rxMstrCallBack(Ptr<Socket> socket);
  void rxSlavCallBack(Ptr<Socket> socket);
};

Defined in connection.h

你知道为什么我会得到这两个错误吗?

4

1 回答 1

0

声明语法需要更改为:

ConnectionType* ConnectionArray = new ConnectionType[NUMBER_OF_CONNECTIONS];
于 2014-11-21T03:56:05.420 回答