如何在其他类中使用sendDirect()函数发送消息?

时间:2020-02-15 14:44:57

标签: omnet++

当我尝试这样调用sendDirect()函数时:

cSimpleModule *module = new cSimpleModule();
module->sendDirect(msg, nodeId,"io");

编译器返回此错误:

omnet sendirect function error

根据Omnet ++文档,此类具有sendDirect()函数:https://doc.omnetpp.org/omnetpp/api//classomnetpp_1_1cSimpleModule.html

我正在尝试在标准cpp文件中使用sendDirect()函数。我所说的标准cpp文件的意思是它与ned文件没有关系(它没有ned文件模块)。

当我在具有定义了sendDirect()的模块的cpp文件中使用Define_Module("moduleName")函数时,sendDirect()函数可以直接使用。它无需创建任何对象即可使用。

我的主要问题是,为什么我不能在没有模块的cpp文件(相关的ned文件)中使用sendDirect()函数?如果可能,怎么可能?

0 个答案:

没有答案