问题
I have the code below, but when I run the simulation I got this error :
Class "myApp" not found -- perhaps its code was not linked in, or the class wasn't registered with Register_Class().
#ifndef MYAPP_H_
#define MYAPP_H_
#include "inet/applications/udpapp/UdpBasicApp.h"
#include <omnetpp.h>
using namespace omnetpp;
using namespace inet;
class myApp : public UdpBasicApp
{
};
Define_Module(myApp);
#endif /* MYAPP_H_ */
package saas;
import inet.applications.udpapp.UdpBasicApp;
simple myApp extends UdpBasicApp{
@class(myApp);
}
回答1:
Define_Module(myApp);
should go into the C++ file along with the implementation (which is also missing from the above listing) and not in the header.
来源:https://stackoverflow.com/questions/56185836/how-to-register-a-new-class-new-application-in-omnet