扩展inet c ++类时虚函数表出错

时间:2016-12-16 13:08:22

标签: omnet++ inet

我想在我自己的项目中扩展一些inet模块。如果我使用下面的代码,我会收到分段错误错误。调试器显示例如Radio.cc想要调用medium-> addRadio(this);实际上它调用SCTPOpenCommand :: setLocalAddresses(const AddressVector& localAddresses),这在项目中绝对没有使用。

MyRadioMedium.ned

package test.physicallayer.common;

import inet.physicallayer.apskradio.packetlevel.APSKScalarRadioMedium;

module MyRadioMedium extends APSKScalarRadioMedium
{
    parameters:
        @class(MyRadioMedium);
}

MyRadioMedium.h

#ifndef INET_MYRADIOMEDIUM_H_
#define INET_MYRADIOMEDIUM_H_

#include "inet/physicallayer/contract/packetlevel/IRadioMedium.h"
#include "inet/physicallayer/common/packetlevel/RadioMedium.h"

namespace inet {

namespace physicallayer {

class INET_API MyRadioMedium: public RadioMedium {

public:
    MyRadioMedium() : RadioMedium() {}
protected:
    virtual bool isInCommunicationRange(const ITransmission *transmission, const Coord startPosition, const Coord endPosition) const override;
};

} // namespace physicallayer

} // namespace inet

#endif

MyRadioMedium.cc

#include <MyRadioMedium.h>

namespace inet {

namespace physicallayer {

Define_Module(MyRadioMedium);

bool MyRadioMedium::isInCommunicationRange(const ITransmission *transmission, const Coord startPosition, const Coord endPosition) const {
    // some code
    return true;
}

} // namespace physicallayer

} // namespace inet

在Windows和ubuntu上显示gdb的屏幕截图

0 个答案:

没有答案