-2

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.

Error: ISO C++ forbids declaration of ‘multiset’ with no type.

The code is:

#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

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

Fernando
  • 13
  • 5
  • You should put your `#include` statements inside your *include guards*. – Galik Aug 07 '15 at 22:16
  • The message says that "This question has been asked before and already has an answer.". In fact the [other question](http://stackoverflow.com/q/31882187/827263) doesn't currently have any answers. This bug in the Stack Exchange code is [discussed here](http://meta.stackexchange.com/q/189782/167210). – Keith Thompson Aug 07 '15 at 22:19
  • @Galik plz explain a bit more. what are include guards. A little help and I could fix it. Thanks a lot. – Fernando Aug 07 '15 at 22:21
  • Move **all** of your `#include` lines so they appear *after* the line: `#define MP_TCP_TYPEDEFS_H`. – Galik Aug 07 '15 at 22:23
  • @KeithThompson Just for curiousity sake, why doesn't stack overflow have options to ask particular people if no answer is obtained (like Quora) ? Bounty is too generic. – Fernando Aug 07 '15 at 22:24
  • @Galik Still getting the exact same errors. Anything else i must try ? – Fernando Aug 07 '15 at 22:25
  • 2
    @KeithThompson This is actually the *same* question as the other one by the same poster. But this question contains the source code in-line. It may be worth marking the *other* question a duplicate of *this* one. – Galik Aug 07 '15 at 22:26
  • @Galik: Good idea, but I don't think I can do that by myself. I can close a question as a duplicate, but re-opening it requires multiple votes. Fernando: I suggest you update your other question to include the information you added to this one. (It would have been better to do that in the first place rather than posting a second question). – Keith Thompson Aug 07 '15 at 22:51
  • @Galik: I actually didn't notice that they were by the same person. I tried to update the title to reflect the exact error message, and was told that there was another question with the same title. – Keith Thompson Aug 07 '15 at 22:52
  • @KeithThompson Sorry for asking again, but still I remain so much frustated with the error. Nobody was looking at the previous question after a few minutes, so I asked again. If possible, could you refer the question to some other experts in c++ or gcc. Thanks a lot. – Fernando Aug 07 '15 at 22:59
  • 1
    You've already posted the question; that's the best way to get attention. Your original question, which unlike this one is still open, doesn't include the code that causes the error. Update *that* question with the relevant code. If possible, narrow it down to a smaller example that illustrates the problem; see http://sscce.org/. You might also want to explain what "waf" is (not to me; add that information to the original question). – Keith Thompson Aug 07 '15 at 23:56

1 Answers1

1

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

template < class T > class multiset;

Such declaration allows multised to be used as :

multiset<double> *pointer;

But not as :

multiset<double> measuredRTT;

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;
}
Anonymous Coward
  • 3,140
  • 22
  • 39