unspoken reflections of my heart
Configure NS-2 with Eclipse in Linux
For most users of NS2, it would be easier if they can use a popular IDE to work with the files.
Here are the step by step instructions I followed to set up NS-2.34 with Eclipse 3.5 in Ubuntu Linux.
In older versions of Eclipse, the settings might be slightly different.
I have compiled the following steps after running into various problems and errors with the setup, and solving them all. So I hope the setup will be smooth for you.
Setting up Eclipse:
- Download Eclipse SDK
- Extract the SDK to a folder
- Open Eclipse
- Go to Help -> Install New Software. In the Work With bar type this:
http://download.eclipse.org/tools/cdt/releases/galileo - Choose CDT Main Features and CDT Optional Features. Install them.
CDT stands for “C/C++ Development Tooling” - If you do not have a working internet connection in the system you have installed Eclipse, instead of steps 4 and 5, download the CDT from the above mentioned site. Then move to Install New Software (see step 4) -> Add and add the archive downloaded.
Installing NS-2
- Download NS-2
- Extract NS-2 to a folder, i.e. /home/username/ns-allinone-2.34
- Edit Makefile:
- Open “…/ns-allinone-2.34/ns-2.34/Makefile.in”and
- Add those lines anywhere near the top of the file:
CCOPT = -g
DEFINE = -DNDEBUG
DEFINE = -DDEBUG - Navigate to …/ns-allinone-2.34/ns-2.34 and run “./configure”
- Navigate to the NS-2 folder using terminal and type ./install
- Also, follow the instructions are displayed at the end of a successful installation. These instructions are to modify the PATH variable and other environment variables as needed.
Adding NS-2 as a Project in 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 should not give Error.
- Running the project must open the console with the NS-2 prompt, %
Setting Debug Configuration:
- Select Run -> Debug Configurations
- 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.
| Print article | This entry was posted by eskay on October 18, 2009 at 11:44 pm, and is filed under linux, technology. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |





about 1 month ago
Hi,
I have tried to follow your procedure in your blog to compile ns2 using eclipse galileo. I am frustrated because I did not find the “normal” eclipse, where everything was fine. Do you know if it is possible to use that instead of eclipse galileo?
Related to eclipse galileo, I can not see the options you described in the IDE:
“Select Project Type as Makefile Project -> Empty C++ Project.
Toolchains: Linux GCC”.
My eclipse galileo version Version: 3.5.2 Build id: M20100211-1343.
Could you help me?