1.首先假设你已经成功编译ns-3.27.(参考网上已有网上ns3安装编译过程)
2.把ns-allinone-3.27/ns-3.27/examples/tutorial/second.cc拷贝至ns-allinone-3.27/ns-3.27/build/scratch/second.cc
3.然后执行 nh@servernh:~/Downloads/ns-allinone-3.27/ns-3.27$ ./waf
来编译second.cc文件,发现ns-allinone-3.27/ns-3.27/build/scratch/下出现了second可执行文件
4.执行nh@servernh:~/Downloads/ns-allinone-3.27/ns-3.27$ sudo ./waf --run second来运行second,得到如下结果:
Waf: Entering directory `/home/nh/Downloads/ns-allinone-3.27/ns-3.27/build'
Waf: Leaving directory `/home/nh/Downloads/ns-allinone-3.27/ns-3.27/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.637s)
At time 2s client sent 1024 bytes to 10.1.2.4 port 9
At time 2.0078s server received 1024 bytes from 10.1.1.1 port 49153
At time 2.0078s server sent 1024 bytes to 10.1.1.1 port 49153
At time 2.01761s client received 1024 bytes from 10.1.2.4 port 9
发现程序能够正常执行。