How to register a new class (new application) in Omnet++

主宰稳场 提交于 2021-01-05 10:46:03

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!