1.在运行第一个例子first.cc时,遇到没有waf的问题,这是因为我下载的是NS3.37,而自从NS3.36开始就不用waf了,可以直接用ns3运行:
./ns3 run first
并且要注意是在ns3文件所在目录下打开终端,first.cc文件也从下面的目录中复制到ns3文件所在的目录下:
或者不复制first.cc文件,直接在ns3文件所在目录下打开终端运行:
./ns3 run examples/tutorial/first
相关帖子:
https://blog.csdn.net/m0_53498801/article/details/131731054
2.按照其他帖子运行以下代码:
./ns3 run first --vis
会出现以下报错信息:
ninja: no work to do.
assert failed. cond="uid != 0", msg="Assert in TypeId::LookupByName: ns3::VisualSimulatorImpl not found", file=/home/xin/repos/ns-3-allinone/ns-3.37/src/core/model/type-id.cc, line=843
terminate called without an active exception
Command 'build/examples/tutorial/ns3.37-first-default --SimulatorImplementationType=ns3::VisualSimulatorImpl' died with <Signals.SIGABRT: 6>.
通过查阅经验帖,发现了问题在于之前的编译过程中,PyViz可视化工具并未被打开,由此可参照此帖子进行尝试:
运行成功结果如图: