Previously, ns2.28 was installed on cygwin. The method is as follows: http://blog.csdn.net/yyx724916/article/details/8613527. Later versions of ns2.30 and ns2.34 were installed. The Installation Method of ns2.30 is the same as that of ns2.28. The installation method of ns2.34 is different from that of the previous two. Therefore, here we will introduce the method of successful installation.
Cygwin is installed in the same way as previously mentioned: http://blog.csdn.net/yyx724916/article/details/8613527. Here we will only introduce the installation of ns2.34:
1. Copy the downloaded ns-allinone-2.34.tar.gz to your cygwin directory. My name is D: \ cygwin \ home \ yyx (yyx is my computer user name, change to your computer user name file) and enter TAR xvfz ns-allinone-2.34.tar.gz, decompress the NS2. decompress the package to the tclunixtime in D: \ cygwin \ home \ yyx \ ns-allinone-2.34 \ tcl8.4.18 \ UNIX. modify the c file:
Add the following red section definition to the file:
# Include "tclint. H"
# Include "tclport. H"
# Include <locale. h>
# Define tm_year_base 1900
# Define isleapyear (x) (x
% 4
= 0)
& (X %
100! =
0 | x
% 400
= 0 ))
/*
* Tclpgetdate is coded to return a pointer to a 'struct tt'.
* Thread safety, this structure must be in thread-specific data.
* The 'tmkey' variable is the key to this buffer.
*/
Static
Tcl_threaddatakey tmkey;
Typedef structthreadspecificdata
{
Struct TM gmtime_buf;
Struct TM localtime_buf;
} Threadspecificdata;
/*
* Add the following definition:
*/
Struct timezone {
Int tz_minuteswest;
Int tz_dsttime;
};
/*
* If we fall back on the thread-unsafe versions of gmtime and localtime,
* Use this mutex to try to protect them.
*/
If the red code is not added, it will appear after you execute./install.
Makefile: 1089: recipefor target
'Tclunixtime. o' failed
.
2. After adding the CD to the ns-allinone-2.34 directory, execute the./install command, and then wait for the installation to complete.
After the installation is complete, set the environment variables:
Add the following code to the last line of the. bashrc file in the Directory D: \ cygwin \ home \ yyx (yyx is my username file:
Export ns_home =/home/yyx/ns-allinone-2.34
Export Path = $ ns_home/bin: $ ns_home/tcl8.4.18/Unix: $ ns_home/tk8.4.18/Unix: $ ns_home/nam-1.14: $ path
Export LD_LIBRARY_PATH = $ ns_home/otcl-1.13: $ ns_home/lib: $ ns_home/tcl8.4.18: $ LD_LIBRARY_PATH
Export tcl_library = $ ns_home/tcl8.4.18/Library
Remember: it is best to download an ultraedit editor from the Internet. In this editor, enter the lines of content in a single word into the. bashrvc file. Otherwise, an error may occur and the NS command cannot be found.
Now ns2.34 is installed. After cygwin is restarted, enter ns to view the % symbol, which indicates that you have installed cygwin successfully!