一、方法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