Difference between revisions of "HOWTO use ns-3 on Windows with Visual Studio 2010"

From Nsnam
Jump to: navigation, search
(No difference)

Revision as of 16:08, 10 February 2013

Installation & Usage for NS3 on Windows (Visual Studio 2010 Only)


  • Microsoft Visual Studio 2010
  • Microsoft Windows 7 or Microsoft Windows XP
  • Mercurial


Download via mercurial : "hg clone http://code.nsnam.org/jabraham3/ns-3-win"

First Build

Currently the Visual Studio Solution is organized into around 30 projects. Each of these projects correspond to the modules in the ns-3-dev line up (example: 'aodv'). However,one project file is named "MyExample". This is the project that will carry the source code with the main function (typically your example source code)

  1. Open the ns-3-dev solution file "ns-3-dev.sln" under the "ns-3-dev\windows" folder
  2. After the solution is opened, Right-click the solution "ns-3-dev" and select "Build Solution". Here is a youtube video showing this.
  3. If the build completes successfully, "MyExample.exe" will be created under the "ns-3-dev\windows\Debug" folder

Note: The solution has "hello-simulator.cc" as the default example. To add your own example go to this link

Running an example

  1. The solution has "hello-simulator.cc" as the default example. To add a new example, remove "hello-simulator.cc" from the "MyExample" project ( MyExample---> Right-click "hello-simulator.cc" --> Select "Remove")
  2. Then Right-click "MyExample"-->Add-->Existing item --> Your example file
  3. Build the solution as previously described

Here is a youtube video showing the above steps


  1. Set a break-point at a suitable location. Lets choose the "Insert" function in "map-scheduler.cc"
  2. Hit the "debug" button at the top portion of your IDE.
  3. Provide input to your application as you normally would.

Here is a youtube video showing these steps.

Using NetAnim on Windows

  • Recommended IDE: QT Creator
  • Building the NetAnim executable:
  1. Download the latest version of NetAnim for Windows here
  2. Unzip the contents of the zip file
  3. Open the NetAnim.pro file using Qt Creator.
  4. In Qt Creator , Select "Build All"
  5. NetAnim.exe will be available in the same directory as the NetAnim.pro file

If you get undefined reference to `WSAStartup` etc try adding the following lines to the "NetAnim.pro" file, if you use the MiniGW toolchain

CONFIG += network
LIBS += -lwsock32

or if you use Visual C++ tool chain

CONFIG += network
LIBS += ws2_32.lib

Here is a youtube video showing the above steps.