我想在我自己的项目中扩展一些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的屏幕截图