我正在尝试访问hostA.cc,但这给了我以下错误:
找不到类“ hostA”-可能未链接其代码,或者未使用Register_Class()或在模块和通道的情况下使用Define_Module()/ Define_Channel( )-在模块(omnetpp :: cModule)WirelessA(id = 1)中,在网络设置期间
按照我的代码.ned和.cc:
@license(LGPL);
import inet.applications.pingapp.PingApp;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.networklayer.ipv4.IIpv4;
import inet.node.inet.INetworkNode;
import inet.visualizer.common.InfoVisualizer;
import inet.visualizer.contract.IIntegratedVisualizer;
import inet.physicallayer.contract.packetlevel.IRadioMedium;
network WirelessA
{
parameters:
@display("bgb=740.44,558.54;bgg=100,1,grey95");
@figure[title](type=label; pos=0,-1; anchor=sw; color=darkblue);
@figure[rcvdPkText](type=indicatorText; pos=380,20; anchor=w; font=,18; textFormat="packets received time: %g"; initialValue=0);
@statistic[packetSent](source=hostA.app[0].packetSent; record=figure(count); targetFigure=rcvdPkText);
submodules:
visualizer: <default("IntegratedCanvasVisualizer")> like IIntegratedVisualizer if hasVisualizer() {
@display("p=580,125");
}
configurator: Ipv4NetworkConfigurator {
@display("p=580,200");
}
radioMedium: <default("UnitDiskRadioMedium")> like IRadioMedium {
@display("p=580,275");
}
hostA: <default("hostA")> like INetworkNode {
@display("p=286.00,333.00");
}
hostB: <default("WirelessHost")> like INetworkNode {
@display("p=495.00,340.00");
}
hostR1: <default("WirelessHost")> like INetworkNode {
@display("p=195.81,105.93;is=s");
}
hostR2: <default("WirelessHost")> like INetworkNode {
@display("p=22.47,21.40");
@networkNode;
}
}
import inet.node.inet.StandardHost;
module hostA extends StandardHost like interface{
parameters:
numWlanInterfaces = default(1);
@class(hostA);
@display("i=device/wifilaptop");
}
.cc
class hostA : public cSimpleModule{
public:
hostA();
protected:
virtual void initialize();
};
Define_Module(hostA);
void hostA::initialize(){
printf("teste");
EV<< "TESTE";
}