如何在 Omnet++ 中注册一个新类(新应用程序) [英] How to register a new class (new application) in Omnet++
本文介绍了如何在 Omnet++ 中注册一个新类(新应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有下面的代码,但是当我运行模拟时出现此错误:
I have the code below, but when I run the simulation I got this error :
未找到myApp"类 -- 可能没有链接到它的代码,或者没有使用 Register_Class() 注册该类.
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);
}
推荐答案
Define_Module(myApp);
应该与实现一起进入 C++ 文件(上面的清单中也没有),而不是在标题中.
should go into the C++ file along with the implementation (which is also missing from the above listing) and not in the header.
这篇关于如何在 Omnet++ 中注册一个新类(新应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文