'Ns2 Modify the source code and compile in ns2

I have been trying to modify the TCP source file parameters and I wanted to execute the modified source file in ns2. Can someone give the steps involved to modify and compile the code in ns2 and I am new in ns2.



Solution 1:[1]


Source code is not used at simulation time. All functions are compiled into one file : The executable 'ns'.

Save your original 'ns' and make a backup copy = 'ns-orig'.

$ cd ns-allinone-2.35/ns-2.35/
$ sudo make install ('make install' will copy 'ns' to /usr/local/bin/ns )
$ sudo cp ns-orig /usr/local/bin/

Building a modified 'ns' ( With your modified TCP ) :

$ cd ns-allinone-2.35/ && ./install
$ cd ns-2.35/
$ cp ns ns-modified
$ cp ns-modified /usr/local/bin/

... Then your new simulation can be done with $ ns-modified [file].tcl



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1