1) Install the NS2.
2) Make a backup copy of your NS2 folder, i.e. ns-allinone-2.34 somewhere so
that you can reset the changes by replacing.
3) Download the Eclipse SDK 3.7.2 Indigo (Classic) from here. This file is
approx. of size 174 MB.
4) Download the CDT from here. This file is approx. of size 44 MB.
5) Copy the "eclipse-SDK-3.7.2-linux-gtk.tar.gz" file to user folder (/home/user)
6) Open the eclipse and set the workspace as /home/user/ns-allinone-2.34.
7) Now in Eclipse go to Help->Install New Software... A window with name
"install" will pop up. Then go to Add. Put the values as shown below.
Location:- Browse to the "cdt-master-6.0.2.zip" file.
8) Check "CDT Main Features" and "CDT Optional Features", click next,
then accept license and finish. At last it will ask you to restart Eclipse, then
9) Now choose /home/user/ns-allinone-2.34 as workspace. Click New->C++
Project. Put Project name:- ns-2.34 (It will warn you that a directory already
exists. Just ignore it.). Choose Project type as make project->Empty project
and Toolchains linux GCC and click finish.
10) Now go to Project->clean->clean projects selected below->ns-2.34 and OK.
11) Go to Project->Build All.
12) After build is completed without any error, go to Run->Run configurations.
Double click C/C++ Application. For Project: browse to ns-2.34. Go to
Search Project and click ns from Program selection window, then Apply and
Run. If you get % sign in console, you are done.
13) (Optional) If you want to speed up the make time of NS2, just don't clean it,
directly build all from Eclipse. It will get compiled in less than 5 seconds.
All the best!