omnet中的导航层次错误:模拟以退出代码:139终止
Navigation hierarchy error in omnet: Simulation terminated with exit code: 139
我正在尝试使用以下代码导航到2级模块:-
cModule* parentmod = getParentModule();
cModule* grantParentmod = parentmod->getParentModule();
for (cSubModIterator iter(*grantParentmod); !iter.end();iter++)
EV<<"Current module is "<< iter()->getFullName() <<endl;
输出为:-
Current module is notificationBoard
Current module is mobility
Current module is udpApp[0]
Current module is udpApp[1]
Current module is udp
Current module is networkLayer
Current module is routingTable
Current module is interfaceTable
Current module is wlan[0]
但是,当我直接尝试通过以下代码访问udpApp[0]时:-
cModule* parentmod = getParentModule();
cModule* grantParentmod = parentmod->getParentModule();
cModule* udpmod = parentmod->getParentModule()->getSubmodule("udpApp[0]");
EV<<"Current module is "<< udpmod->getFullName() <<endl;
仿真在运行时结束,出现以下错误:仿真终止,exit code: 139,这意味着有分段错误。但是,如果我使用任何其他模块,如'mobility'而不是'udpApp[0]',那么它可以正常工作。
谁能帮我想出一个可能的方法来解决这个问题?你得到这个错误,因为你试图解引用一个空指针。你得到一个空指针,因为模块名称"xyz[123]"给getSubmodule不存在。它不存在,因为方括号中的数字不是子模块名称的一部分,而是它在模块向量中的索引。名称和索引必须在调用getSubmodule时分别指定。
相关文章:
- pclose() 不会给我进程退出代码
- Netbeans 10:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- 链接器命令失败,macOS 上的退出代码为 1(使用 -v 查看调用)
- 为什么我的 c++ 代码在使用堆栈时以退出代码 11 结尾?
- 使用常量字符*时退出代码 139
- 程序显示以退出代码 0; 结束
- VSCode C++终端进程已终止,退出代码为:1
- CMake 错误:链接器命令失败,退出代码为 1 和 cpp.o 文件
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) - 体系结构的未定义符号 x86_64:
- 如何修复 clang: 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- CLion、MinGW 和 SDL2:进程已完成,退出代码为 -1073741515 (0xC0000135)
- 运行Qt时处理退出代码0xC0000135 hello world
- 获取加速::p rocess::子的退出代码 在提升::asio::io_service?
- Xcode:链接器命令失败,退出代码为 1(使用 -v 查看调用)[C++]
- 重载 <= 运算符,但程序以退出代码 -1073741571 (0xC00000FD) 结尾
- Android NDK.Build命令失败.未定义的引用.clang++:错误:链接器命令失败,退出代码为1
- 终端进程终止,退出代码为:1有什么方法可以修复它吗
- 运行自定义可执行文件,QProcess 立即退出,退出代码为 1
- 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用):在 Macbook 上
- C++ XCODE ld:找不到体系结构x86_64 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -