一、方法1: 在安装目录下:
$ ./waf --run non-program
注意 non-program 是随便起的一个名字,即当前不存在的一个程序名。
我安装的版本是 ns-3-dev ,gpf@guopengfei:~/repos/ns-3-allinone/ns-3-dev$ ./waf --run non-program
执行后,会提示你当前不存在 non-program ,并会列出当前可以运行的全部程序。
Waf: Entering directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
program 'non-program' not found; available programs are: ['main-callback', 'src/core/examples/main-callback', 'sample-simulator', 'src/core/examples/sample-simulator', 'main-ptr', 'src/core/examples/main-ptr', 'main-random-variable', 'src/core/examples/main-random-variable',
'sample-random-variable', 'src/core/examples/sample-random-variable', 'main-test-sync', 'src/core/examples/main-test-sync', 'main-packet-header', 'src/network/examples/main-packet-header', 'main-packet-tag', 'src/network/examples/main-packet-tag', 'main-simple',
'src/internet/examples/main-simple', 'main-propagation-loss', 'src/propagation/examples/main-propagation-loss', 'main-attribute-value',
...
这样,你就可以执行具体的程序,
比如:
./waf --run main-callback
结果:
Waf: Entering directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
Waf: Leaving directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
'build' finished successfully (3.826s)
invoke cbOne a=10, b=20
invoke cbTwo a=10
以及执行:
./waf --run src/core/examples/sample-simulator
结果:
Waf: Entering directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
Waf: Leaving directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
'build' finished successfully (3.633s)
ExampleFunction received event at 5s
RandomFunction received event at 11.6331s
Member method received event at 13s started at 5s
二、方法2,到程序的具体目录查看
我的ns-3安装在 ~/repos/ns-3-allinone/ns-3-dev目录下
具体可执行程序在 build/debug目录下
在build/debug下 exmples目录,scratch目录,src目录, utilis目录下,都有可执行的程序,用户可以查看。
比如,在我电脑中 build/debug/src/core/examples/目录下,有sample-random-variable可执行程序,
则
$ ./waf --run src/core/examples/sample-random-variable
结果:
Waf: Entering directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
Waf: Leaving directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
'build' finished successfully (3.687s)
0.816532
备注:
1. 程序的执行,是以 build/debug此目录为当前目录。
比如,我个人经常把自己编写的程序放在 ~/repos/ns-3-allinone/ns-3-dev/scratch目录中,
用./waf命令编译后,结果放在 ~/repos/ns-3-allinone/ns-3-dev/build/debug/scratch目录中。
执行的时候 $ ./waf --run scratch/my-program
2.在执行的时候,可以不输入目录,waf会自动定位该程序的位置,如:
./waf --run scratch-simulator
结果:
Waf: Entering directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
Waf: Leaving directory `/home/gpf/repos/ns-3-allinone/ns-3-dev/build'
'build' finished successfully (3.823s)
Scratch Simulator
在ns-3中查看当前有哪些程序可以执行
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Ubuntu14.04下安装与编译ns-3
yoomiky
2020-07-08 07:40:27
ns-3版本升级的问题
ns-3版本升級的問題 在網上查了一個下午,一直沒有找到找到較好的方法。 所以,只有使有最原始的方法,新安裝一個 ns-3.12。 對於從 ns3.
海淼
2020-07-07 13:56:38
NS-3中wifi的主要层次结构
wifi 一、WifiHelper http://www.nsnam.org/doxygen/classns3_1_1_wifi_helper.h
海淼
2020-07-07 13:56:37
在ns-3中运行程序
在ns-3中運行程序 一、運行c++代碼 直接運行: 首先編譯 ./waf 然後執行 ./waf --run program-name prog
海淼
2020-07-07 13:56:35
安装 ns-3.12
1.下載 從這個頁面下載:http://www.nsnam.org/ns-3-12/ The source code can be download
海淼
2020-07-07 13:56:34
带领师弟学习NS3之一
NS3官方網站: 瀏覽http://www.nsnam.org/ ,大致知道網站佈局,以便今後找資料進行學習; 操作系統安裝: 安裝虛擬光驅:DTLite4413.exe; 安裝虛擬機軟件:VMWa
loloha007
2020-07-02 02:54:24
Ubuntu18.04系统下NS3+eclipse安装
Lanzijingshizi
2020-03-07 07:17:28
Vehicular ad-hoc network
海淼
2020-02-25 01:22:25
添加自己编写的模块到ns-3中出现undefined reference to问题的解决
海淼
2020-02-25 01:22:25
一个ns-3的Gnuplot例子
海淼
2020-02-25 01:22:25
Manhattan mobility model
海淼
2020-02-25 01:22:25
How To Install ns3 on linux ? [转]
海淼
2020-02-25 01:22:25
下载ns-3-dev
海淼
2020-02-25 01:22:25