It was originally installed in win_cygwin, but it is still relatively smooth, basically no problem. Recently, I have been playing with VisualBox and Ubuntu. I am going to install NS2. by the way, I want to learn about Linux. Learning requires 2.31, installation is faulty, without carefully reading the error information, otcl is incorrect, reckless think that the version is faulty, under ns2.34, currently the latest, 09 years. It is estimated that ns3 is getting off, and 2 has stopped release. Transfer to the subject. $ Wgethttp: // nchc.dl.sourceforge.net was originally installed under win_cygwin, but it is still relatively smooth, basically no problem. Recently, I have been playing with VisualBox and Ubuntu. I am going to install NS2. by the way, I want to learn about Linux.
Learning requires 2.31, installation is faulty, without carefully reading the error information, otcl is incorrect, reckless think that the version is faulty, under ns2.34, currently the latest, 09 years. It is estimated that ns3 is getting off, and 2 has stopped release.
Transfer to the subject.
$ wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.34.tar.gz
$ tar -xzvf ns-allinone-2.34.tar.gz
$ cd ns-allinone-2.34
$ sudo apt-get install build-essential autoconf automake libxmu-dev
$ ./install
Installation is also in progress, OTCL error, exit, unknown reason ("otcl-1.13 make failed! Exiting ..." I don't know why, google)
Solution:
Makefile. in ns-allinone-2.34/ns-2.34, modify
CC = @ CC @ change CC = gcc-4.3
CPP = @ CXX @ change to CPP = g ++-4.3
In OS, there are gcc, g ++?
$ Sudo apt-get install g ++-4.3
$ CC = gcc-4.3 CXX = g ++-4.3./install
Run ......
I didn't see it clearly in the middle./install and re-work. The installation is complete. I still don't know the Linix mechanism. www.linuxidc.com!
Modify environment variables:
$ Gedit ~ /. Bashrc
Add at the end:
# LD_LIBRARY_PATH
OTCL_LIB =/your/path/ns-allinone-2.34/otcl-1.13
NS2_LIB =/your/path/ns-allinone-2.34/lib
X11_LIB =/usr/X11R6/lib
USR_LOCAL_LIB =/usr/local/lib
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ OTCL_LIB: $ NS2_LIB: $ X11_LIB: $ USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB =/your/path/ns-allinone-2.34/tcl8.4.18/library
USR_LIB =/usr/lib
Export TCL_LIBRARY = $ TCL_LIB: $ USR_LIB
# PATH
XGRAPH =/your/path/ns-allinone-2.34/bin:/your/path/ns-allinone-2.34/tcl8.4.18/unix:/your/path/ns-allinone-2.34/tk8.4.18/unix
NS =/your/path/ns-allinone-2.34/ns-2.34/
NAM =/your/path/ns-allinone-2.34/nam-1.14/
PATH = $ PATH: $ XGRAPH: $ NS: $ NAM
To make the modified environment variables take effect immediately, run
$ Source ~ /. Bashrc
Now OK
$ Ns
% Appears, prove everything is complete OK
I tried an example.
Go to eclipse to debug the ns Program
Eclipse
Open Eclipse
Set the workspace as the ns installation path (/home/username/ns-allinone-2.34) by selecting File-> Switch Workspace
Choose File-> New-> Project-> C ++ Project
Select Project Type as Makefile Project-> Empty C ++ Project.
Toolchains: Linux GCC
Enter Project Name as ns-2.34
Uncheck "Use default location" then browse to the directory NS-2 source directory (... /Ns-allione-2.34/ns-2.34)
Select "Next" and "Finish.
From the workspace, Selecting the NS-2 Project and choosing Project-> Build All shoshould not give Error.
Running the project must open the console with the NS-2 prompt, %
Setting Debug Configuration:
Select Run-> Debug deployments
Choose C/C ++ Application. Type in any name.
Under the Main tab, Choose the following:
Project as ns-2.34.
C/C ++ Application as ns. (Search Project and Choose this)
Under the Debugger tab, choose GDB Debugger. Uncheck the "Stop on startup at" option.
Apply and Debug.