【发布时间】:2018-06-05 15:56:06
【问题描述】:
我是 OMNeT++ 的新手,我现在正在学习 OMNeT++。我想根据教程运行 tictoc 模拟。首先我无法创建项目,它说错误:CoreException。有人告诉我更改文本文件编码成UTF-8。然后问题就解决了。但是当我添加一个新的C++源文件时,又出现了一个问题:无法解决。
#include <string.h>
#include <omnetpp.h>
class Txc1 : public cSimpleModule
{
protected:
virtual void initialize();
virtual void handleMessage(cMessage *msg);
};
Define_Module(Txc1);
void Txc1::initialize()
{
// Am I Tic or Toc?
if (strcmp("tic", getName()) == 0)
{
cMessage *msg = new cMessage("tictocMsg");
send(msg, "out");
}
}
void Txc1::handleMessage(cMessage *msg)
{
send(msg, "out");
}
cSimpleModule,Define_Module,cMessage...这一切都无法解决。
但令人难以置信的是,我可以构建项目。当我单击菜单运行->运行为 OMNeT++ 模拟时,它运行正常。那么更改文本文件编码是否会导致此问题?我该如何解决?
【问题讨论】:
-
你能发布确切的错误吗?无法正常解析的方法意味着找不到相应的头文件,这可能是 OMNeT++ IDE 或您的代码的问题(即不包括正确的头文件)。
标签: c++ simulation omnet++