ISO C ++多集禁止宣言 [英] ISO C++ Forbids Declaration of Multiset

查看:673
本文介绍了ISO C ++多集禁止宣言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用WAF来构建一个软件,我得到的错误:

I am trying to build a software using waf and I get the error:

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
../src/internet-stack/mp-tcp-typedefs.cc: In member function ‘void ns3::MpTcpSubFlow::updateRTT(uint32_t, ns3::Time)’:
../src/internet-stack/mp-tcp-typedefs.cc:550: error: ‘measuredRTT’ was not declared in this scope
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
In file included from ../src/internet-stack/mp-tcp-socket-impl.h:19,
                 from ../src/internet-stack/mp-tcp-l4-protocol.h:19,
                 from ../src/internet-stack/mp-tcp-l4-protocol.cc:11:
../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 debug/ns3/mp-tcp-socket-impl.h:19,
                 from ../src/applications/packet-sink/mp-tcp-packet-sink.h:9,
                 from ../src/applications/packet-sink/mp-tcp-packet-sink.cc:13:
debug/ns3/mp-tcp-typedefs.h:151: error: ISO C++ forbids declaration of ‘multiset’ with no type
debug/ns3/mp-tcp-typedefs.h:151: error: expected ‘;’ before ‘<’ token
../src/internet-stack/mp-tcp-socket-impl.cc: In member function ‘void ns3::MpTcpSocketImpl::GenerateRTTPlot()’:
../src/internet-stack/mp-tcp-socket-impl.cc:1884: error: ‘class ns3::MpTcpSubFlow’ has no member named ‘measuredRTT’
../src/internet-stack/mp-tcp-socket-impl.cc:1901: error: ‘class ns3::MpTcpSubFlow’ has no member named ‘measuredRTT’
../src/internet-stack/mp-tcp-socket-impl.cc:1913: error: ‘multiset’ was not declared in this scope
../src/internet-stack/mp-tcp-socket-impl.cc:1913: error: expected primary-expression before ‘double’
../src/internet-stack/mp-tcp-socket-impl.cc:1913: error: expected ‘;’ before ‘double’
../src/internet-stack/mp-tcp-socket-impl.cc:1915: error: ‘it’ was not declared in this scope
../src/internet-stack/mp-tcp-socket-impl.cc:1917: error: ‘class ns

3::MpTcpSubFlow’ has no member named ‘measuredRTT’

我无法找到一个方法来解决此错误:正如你可以看到,我已经填写正确的命名空间和头部

I can't find a way to resolve the error: As you could see that I have the namespaces and headers filled correctly.

错误:ISO C ++禁止多集的声明无类型

在code是:

#include <vector>
#include <map>
#include "sequence-number.h"
#include "rtt-estimator.h"
#include "tcp-typedefs.h"
#include "ns3/ipv4-address.h"
#include "ns3/event-id.h"
#include <stdint.h>
#include <queue>
#include <list>
#include <set>

#include "ns3/object.h"
#include "ns3/uinteger.h"
#include "ns3/traced-value.h"
#include "ns3/trace-source-accessor.h"

#ifndef MP_TCP_TYPEDEFS_H
#define MP_TCP_TYPEDEFS_H

using namespace std;

namespace ns3 {

typedef enum {
  MP_NONE,        // 0
  MP_MPC,         // 1
  MP_ADDR,        // 2
  MP_JOIN} MpStates_t;
// Multipath actions

// congestion control algorithm
typedef enum {
  Uncoupled_TCPs,       // 0
  Linked_Increases,     // 1
  RTT_Compensator,      // 2
  Fully_Coupled         // 3
  } CongestionCtrl_t;

// connection phase
typedef enum {
  Slow_Start,                   // 0
  Congestion_Avoidance,         // 1
  DSACK_SS,                     // 2 DSACK Slow Start: a temporary slow start triggered after detecting spurious retransmission based on DSACK information
  RTO_Recovery                  // 3 Reconvery algorithm after RTO expiration
  } Phase_t;

typedef enum {
  Round_Robin        // 0
  //Collision_Avoidance         // 1
  } DataDistribAlgo_t;

typedef enum {
  NoPR_Algo,    // 0
  Eifel,        // 1
  TCP_DOOR,     // 2 Detection of Out-of-Order and Response
  D_SACK,       // 3 Duplicate SACK (Selective ACKnowledgement)
  F_RTO         // 4 Forward RTO-Recovery: Algorithm for detecting spurious retransmission timeouts
  } PacketReorder_t;

typedef enum {
  Step_1,       // 0
  Step_2,       // 1
  Step_3,       // 2
  Step_4        // 3 In this step of F-RTO do a standard Fast Recovery algorithm
  } FRtoStep_t;

class DSNMapping
{
public:
    DSNMapping ();
    DSNMapping (uint8_t sFlowIdx, uint64_t dSeqNum, uint16_t dLvlLen, uint32_t sflowSeqNum, uint32_t ack, Ptr<Packet> pkt);
    //DSNMapping (const DSNMapping &res);
    virtual ~DSNMapping();
    uint64_t dataSeqNumber;
    uint16_t dataLevelLength;
    uint32_t subflowSeqNumber;
    uint32_t acknowledgement;
    uint32_t dupAckCount;
    uint8_t  subflowIndex;
    uint8_t *packet;

    bool operator <  (const DSNMapping& rhs) const;

    // variables for reordering simulation
    // Eifel Algorithm
    bool     retransmited;
    uint64_t tsval; // TimesTamp value

/*
private:/
    bool original;
    */
};

typedef enum {
  NO_ACTION,       // 0
  ADDR_TX,
  INIT_SUBFLOWS} MpActions_t;

class MpTcpStateMachine : public TcpStateMachine
{
public:

    MpTcpStateMachine();
    virtual ~MpTcpStateMachine();

    string printState(States_t s);
    string printEvent(Events_t e);
    string printAction(Actions_t a);

};

class MpTcpSubFlow : public Object
{
public:
    static TypeId GetTypeId (void);

    MpTcpSubFlow ();
    ~MpTcpSubFlow ();
    MpTcpSubFlow (uint32_t TxSeqNb);

    void StartTracing (string traced);
    void CwndTracer (double oldval, double newval);

    void AddDSNMapping(uint8_t sFlowIdx, uint64_t dSeqNum, uint16_t dLvlLen, uint32_t sflowSeqNum, uint32_t ack, Ptr<Packet> pkt);
    void updateRTT (uint32_t ack, Time current);
    DSNMapping * GetunAckPkt (uint32_t awnd);

    uint16_t    routeId;
    bool        connected;
    States_t    state;
    Phase_t     phase;
    Ipv4Address sAddr;
    uint16_t    sPort;
    Ipv4Address dAddr;
    uint16_t    dPort;
    uint32_t    oif;

    EventId  retxEvent;
    uint32_t MSS;          // Maximum Segment Size
    //double   cwnd;
    TracedValue<double> cwnd;
    double   scwnd;         // smoothed congestion window
    uint32_t ssthresh;
    uint32_t maxSeqNb;     // it represent the highest sequence number of a sent byte. In general it's egual to ( TxSeqNumber - 1 ) until a retransmission happen
    uint32_t highestAck;   // hightest received ACK for the subflow level sequence number
    uint64_t bandwidth;

    list<DSNMapping*> mapDSN;
    multiset<double> measuredRTT;
    //list<double> measuredRTT;
    Ptr<RttMeanDeviation> rtt;
    Time     lastMeasuredRtt;
    uint32_t TxSeqNumber;
    uint32_t RxSeqNumber;

    // for losses simulation
    double   LostThreshold;
    bool     CanDrop;
    uint64_t PktCount;
    uint64_t MaxPktCount;
    uint32_t DropedPktCount;
    uint32_t MaxDropedPktCount;

    // Reordering simulation
    double   savedCWND;
    uint32_t savedSSThresh;
    bool     SpuriousRecovery;
    uint32_t recover;
    uint8_t  ackCount;      // count of received acknowledgement after an RTO expiration
    uint32_t ReTxSeqNumber; // higher sequence number of the retransmitted segment
    int      nbRecvAck;
};

class MpTcpAddressInfo
{
public:
    MpTcpAddressInfo();
    ~MpTcpAddressInfo();

    uint8_t     addrID;
    Ipv4Address ipv4Addr;
    Ipv4Mask    mask;
};

class DataBuffer
{
public:
    DataBuffer();
    DataBuffer(uint32_t size);
    ~DataBuffer();

    queue<uint8_t> buffer;
    uint32_t bufMaxSize;

    uint32_t Add(uint8_t* buf, uint32_t size);
    uint32_t Retrieve(uint8_t* buf, uint32_t size);
    Ptr<Packet> CreatePacket (uint32_t size);
    uint32_t ReadPacket (Ptr<Packet> pkt, uint32_t dataLen);
    bool     Empty();
    bool     Full ();
    uint32_t PendingData();
    uint32_t FreeSpaceSize();
};


}//namespace ns3
#endif //MP_TCP_TYPEDEFS_H

我上面code是MP-TCP-typedefs.h文件。

I above code is the mp-tcp-typedefs.h file.

推荐答案

这意味着,多集已经在类似的方式被向前声明:

It means that multiset has been forward declared in a way similar to :

template < class T > class multiset;

这样的声明允许multised用作:

Such declaration allows multised to be used as :

multiset<double> *pointer;

但不作为:

multiset<double> measuredRTT;

以下code,这是一样的你没有你的项目的标题和不code根据他们的编译没有错误。结果
我只能得出结论,这个问题是不是在code您发布,但其中的一些头。

The following code, which is the same as yours without the headers of your project and without code depending on them compiles without error.
I can only conclude that the problem is not in the code you posted but in some of those headers.

#include <vector>
#include <map>
#include <stdint.h>
#include <queue>
#include <list>
#include <set>

#ifndef MP_TCP_TYPEDEFS_H
#define MP_TCP_TYPEDEFS_H

using namespace std;

namespace ns3 {

typedef enum {
  MP_NONE,        // 0
  MP_MPC,         // 1
  MP_ADDR,        // 2
  MP_JOIN} MpStates_t;
// Multipath actions

// congestion control algorithm
typedef enum {
  Uncoupled_TCPs,       // 0
  Linked_Increases,     // 1
  RTT_Compensator,      // 2
  Fully_Coupled         // 3
  } CongestionCtrl_t;

// connection phase
typedef enum {
  Slow_Start,                   // 0
  Congestion_Avoidance,         // 1
  DSACK_SS,                     // 2 DSACK Slow Start: a temporary slow start triggered after detecting spurious retransmission based on DSACK information
  RTO_Recovery                  // 3 Reconvery algorithm after RTO expiration
  } Phase_t;

typedef enum {
  Round_Robin        // 0
  //Collision_Avoidance         // 1
  } DataDistribAlgo_t;

typedef enum {
  NoPR_Algo,    // 0
  Eifel,        // 1
  TCP_DOOR,     // 2 Detection of Out-of-Order and Response
  D_SACK,       // 3 Duplicate SACK (Selective ACKnowledgement)
  F_RTO         // 4 Forward RTO-Recovery: Algorithm for detecting spurious retransmission timeouts
  } PacketReorder_t;

typedef enum {
  Step_1,       // 0
  Step_2,       // 1
  Step_3,       // 2
  Step_4        // 3 In this step of F-RTO do a standard Fast Recovery algorithm
  } FRtoStep_t;

class DSNMapping
{
public:
    DSNMapping ();

    //DSNMapping (const DSNMapping &res);
    virtual ~DSNMapping();
    uint64_t dataSeqNumber;
    uint16_t dataLevelLength;
    uint32_t subflowSeqNumber;
    uint32_t acknowledgement;
    uint32_t dupAckCount;
    uint8_t  subflowIndex;
    uint8_t *packet;

    bool operator <  (const DSNMapping& rhs) const;

    // variables for reordering simulation
    // Eifel Algorithm
    bool     retransmited;
    uint64_t tsval; // TimesTamp value

/*
private:/
    bool original;
    */
};

typedef enum {
  NO_ACTION,       // 0
  ADDR_TX,
  INIT_SUBFLOWS} MpActions_t;

class MpTcpStateMachine 
{
public:

    MpTcpStateMachine();
    virtual ~MpTcpStateMachine();





};

class MpTcpSubFlow 
{
public:


    MpTcpSubFlow ();
    ~MpTcpSubFlow ();
    MpTcpSubFlow (uint32_t TxSeqNb);

    void StartTracing (string traced);
    void CwndTracer (double oldval, double newval);



    DSNMapping * GetunAckPkt (uint32_t awnd);

    uint16_t    routeId;
    bool        connected;

    Phase_t     phase;

    uint16_t    sPort;

    uint16_t    dPort;
    uint32_t    oif;


    uint32_t MSS;          // Maximum Segment Size
    //double   cwnd;

    double   scwnd;         // smoothed congestion window
    uint32_t ssthresh;
    uint32_t maxSeqNb;     // it represent the highest sequence number of a sent byte. In general it's egual to ( TxSeqNumber - 1 ) until a retransmission happen
    uint32_t highestAck;   // hightest received ACK for the subflow level sequence number
    uint64_t bandwidth;

    list<DSNMapping*> mapDSN;
    multiset<double> measuredRTT;
    //list<double> measuredRTT;


    uint32_t TxSeqNumber;
    uint32_t RxSeqNumber;

    // for losses simulation
    double   LostThreshold;
    bool     CanDrop;
    uint64_t PktCount;
    uint64_t MaxPktCount;
    uint32_t DropedPktCount;
    uint32_t MaxDropedPktCount;

    // Reordering simulation
    double   savedCWND;
    uint32_t savedSSThresh;
    bool     SpuriousRecovery;
    uint32_t recover;
    uint8_t  ackCount;      // count of received acknowledgement after an RTO expiration
    uint32_t ReTxSeqNumber; // higher sequence number of the retransmitted segment
    int      nbRecvAck;
};

class MpTcpAddressInfo
{
public:
    MpTcpAddressInfo();
    ~MpTcpAddressInfo();

    uint8_t     addrID;


};

class DataBuffer
{
public:
    DataBuffer();
    DataBuffer(uint32_t size);
    ~DataBuffer();

    queue<uint8_t> buffer;
    uint32_t bufMaxSize;

    uint32_t Add(uint8_t* buf, uint32_t size);
    uint32_t Retrieve(uint8_t* buf, uint32_t size);


    bool     Empty();
    bool     Full ();
    uint32_t PendingData();
    uint32_t FreeSpaceSize();
};


}//namespace ns3
#endif //MP_TCP_TYPEDEFS_H

/// Added just so that the linker does not complain about lack of missing main
int main(int argc, char* argv[] )
{
    return 0;
}

这篇关于ISO C ++多集禁止宣言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆