如果运行此代码,为什么会得到错误代码139? [英] Why I get an error code 139 if I run this code?
问题描述
我想知道为什么可以构建该项目,但是RSU收到该消息后,我会收到一条错误139.即使我尝试通过删除插入在onData函数中的代码来解决并再次运行该项目,不起作用.
I would like to know why I can build this project, but as soon as RSU receives the message I get an error 139. Even if I try to solve by removing the code inserted in onData function and run the project again, still doesn't work.
TraCIScenarioManager* manager;
TraCICommandInterface* traci;
TraCIDemoRSU11p.cc
void TraCIDemoRSU11p::initialize(int stage)
{
BaseWaveApplLayer::initialize(stage);
if (stage == 0) {
manager = TraCIScenarioManagerAccess().get();
traci = manager->getCommandInterface();
traci->trafficlight("0").setProgram("tram_is_not_passing");
}
}
void TraCIDemoRSU11p::onData(WaveShortMessage* wsm)
{
traci->trafficlight("0").setProgram("tram_is_passing");
}
静脉版本是4.4,而omnet ++版本是5.我认为问题可能出在初始化函数中是如何获得traci接口的,请问谁能解释两个模块如何同时使用traci接口?
veins version is 4.4 and omnet++ version is 5. I think the problem might be how I got traci interface in the initialize function, can anyone please explain how two modules use traci interface at the same time?
根据要求,我要向问题添加更多信息.
As requested I am adding more information to the question.
....
<tlLogic id="0" type="static" programID="1" offset="0">
<phase duration="500" state="rGrG"/>
</tlLogic>
....
Cross.tls.xml
<tls>
<tlLogic id="0" type="static" programID="tram_is_passing" offset="0">
<phase duration="4" state="ryry"/>
<phase duration="20" state="GrGr"/>
</tlLogic>
<tlLogic id="0" type="static" programID="tram_is_not_passing" offset="0">
<phase duration="999" state="rGrG"/>
</tlLogic>
</tls>
推荐答案
据我所知,OMNeT ++的错误代码从128开始,然后添加了正常的系统错误代码.这意味着139 = 128 + 11和11是分段错误的错误代码.
As far as I know, OMNeT++ starts at 128 with its error codes and than adds the normal system error codes. This means that 139 = 128 + 11 and 11 is the error code for a segmentation fault.
因此,似乎您正在尝试使用未分配或不允许使用的内存空间.您应该使用./memcheck
与Valgrind进行模拟,以查明是否存在内存泄漏.
Hence, it seems you are trying to use memory space which is not allocated or you are not allowed to use. You should run you simulation with Valgrind using ./memcheck
to find out whether you have memory leaks.
编辑:在Veins 4.7.1之后,一个新的运行脚本是介绍.现在,您可以使用./run -t memcheck
与Valgrind一起运行仿真.
EDIT: After Veins 4.7.1 a new run script was introduced. Now you can run your simulation with Valgrind using ./run -t memcheck
.
这篇关于如果运行此代码,为什么会得到错误代码139?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!