HOWTO configure Eclipse with ns-3

From Nsnam
Revision as of 09:06, 26 January 2011 by Socket (Talk | contribs)

Jump to: navigation, search

Configure Mercurial

  • First download eclipse IDE for C++ developers from
  • Install eclipse into you operating system
  • Install mercurial eclipse plugin:
  • We suppose that you already have mercurial installed on your machine
  • start eclipse, it will create a workspace directory NB:It is advised to use a different directory for the code say ~/src
  • clone the mercurial reppository: go to ~/src and execute hg clone ns-3-dev
  • create a new empty C++ project with your preferred name and the path is ~/src/ns-3-dev on
  • click right on the project and go to team->share project
  • click on next and click on use local hg and finish

You should have now your project configured with eclipse and be able to pull, update, view history, etc in eclipse. The next steps will allow you to configure, compile and run the code from eclipse.

Configure Waf Builder

Builder Settings Screenshot
Builder Behaviour Screenshot
  • Click right on the project and click on properties
  • Click on C/C++ build and configure the builder
  • Uncheck the box Use default build command
  • Uncheck the box Generate makefile automatically
  • Write ${workspace_loc:ns-3-dev}/waf in the build command
  • Make sure your build directory is the build directory in ns-3-dev (${workspace_loc:ns-3-dev}/build)
  • Click on the behaviour tab
  • Remove the `all` option in front of the build checkbox and write `build`
  • Now when you click on build you will be able to build the project using waf

Configure Debugger

Debugger main tab
Debugger environment tab

Suppose you want to debug a test application called "test" under the scratch folder. Here are the steps:

  • Click on the "Debug Configurations" option under the "Run" menu
  • Create a new configuration and choose a name for it
  • Click on the "Browse" button under the "Project" section and select the project
  • Click on the "Search Project" button under the "C/C++ Application" section and type the name of the application (test in our case)
  • Go into the "Environment" tab and click on "New" to create a new variable
  • Type under the Name field "LD_LIBRARY_PATH"
  • Type under the Value field "${workspace_loc:ns-3-dev}/build/debug"
  • Be sure the "Append environment to native environment" is selected
  • Click on Apply and on Debug if you want to immediately debug the application

--Socket 09:06, 26 January 2011 (UTC)