Difference between revisions of "HOWTO use ns-3 on Windows with Visual Studio 2010"
(→Adding your code) |
m (Vedranm moved page Windows Port of ns-3 using Visual Studio Installation and Usage to HOWTO use ns-3 on Windows with Visual Studio 2010: Wiki page name cleanup) |
||
(96 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | This page covers installation and usage for ns-3 on Windows using Visual Studio 2010 only. Please see also see [[Windows Port of ns-3 using Visual Studio|information about the port]]. | |
+ | |||
= Requirements = | = Requirements = | ||
* Microsoft Visual Studio 2010 | * Microsoft Visual Studio 2010 | ||
* Microsoft Windows 7 or Microsoft Windows XP | * Microsoft Windows 7 or Microsoft Windows XP | ||
− | + | * Mercurial | |
− | + | ||
− | + | ||
− | + | ||
= Download = | = Download = | ||
+ | Download via mercurial : "hg clone http://code.nsnam.org/jabraham3/ns-3-win" | ||
+ | |||
= First Build = | = 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) | |
+ | # Open the ns-3-dev solution file "ns-3-dev.sln" under the "ns-3-dev\windows" folder | ||
+ | # After the solution is opened, Right-click the solution "ns-3-dev" and select "Build Solution". Here is a [http://www.youtube.com/watch?v=br-WfAN3n8s youtube video] showing this. | ||
+ | # If the build completes successfully, "MyExample.exe" will be created under the "ns-3-dev\windows\Debug" folder | ||
− | The | + | Note: The solution has "hello-simulator.cc" as the default example. |
− | + | To add your own example go to this link | |
− | + | ||
− | + | ||
− | + | ||
= Running an example = | = Running an example = | ||
− | # | + | # 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") |
− | + | # Then Right-click "MyExample"-->Add-->Existing item --> Your example file | |
− | + | # Build the solution as previously described | |
− | + | ||
− | + | ||
− | # | + | |
− | # | + | |
− | Here is a [http://www.youtube.com/watch?v= | + | Here is a [http://www.youtube.com/watch?v=_1dYM3COCq4 youtube video] showing the above steps |
− | = | + | = Debugging = |
− | + | # Set a break-point at a suitable location. Lets choose the "Insert" function in "map-scheduler.cc" | |
− | + | # Hit the "debug" button at the top portion of your IDE. | |
− | + | # Provide input to your application as you normally would. | |
− | # | + | |
− | # | + | Here is a [http://www.youtube.com/watch?v=YmaJ53PSXWU youtube video] showing these steps. |
− | + | ||
− | / | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | # | + | = Using NetAnim on Windows = |
− | # | + | * Recommended IDE: [http://qt.nokia.com/products/developer-tools/ QT Creator] |
− | + | * Building the NetAnim executable: | |
− | + | # Download the latest version of NetAnim for Windows [http://code.nsnam.org/jabraham3/ns3-on-windows/ns-3.10-Win-1.2/raw-file/78d716fec82a/NetAnim.zip here] | |
+ | # Unzip the contents of the zip file | ||
+ | # Open the NetAnim.pro file using Qt Creator. | ||
+ | # In Qt Creator , Select "Build All" | ||
+ | # 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 | |
− | + | <nowiki> | |
− | + | CONFIG += network | |
− | + | LIBS += -lwsock32 | |
− | + | ||
− | + | ||
</nowiki> | </nowiki> | ||
− | = | + | or if you use Visual C++ tool chain |
+ | <nowiki> | ||
+ | CONFIG += network | ||
+ | LIBS += ws2_32.lib | ||
+ | </nowiki> | ||
+ | |||
+ | |||
+ | Here is a youtube [http://www.youtube.com/watch?v=Sl9Xwemg6ss video] showing the above steps. |
Latest revision as of 16:32, 10 February 2013
This page covers installation and usage for ns-3 on Windows using Visual Studio 2010 only. Please see also see information about the port.
Contents
Requirements
- Microsoft Visual Studio 2010
- Microsoft Windows 7 or Microsoft Windows XP
- Mercurial
Download
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)
- Open the ns-3-dev solution file "ns-3-dev.sln" under the "ns-3-dev\windows" folder
- After the solution is opened, Right-click the solution "ns-3-dev" and select "Build Solution". Here is a youtube video showing this.
- 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
- 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")
- Then Right-click "MyExample"-->Add-->Existing item --> Your example file
- Build the solution as previously described
Here is a youtube video showing the above steps
Debugging
- Set a break-point at a suitable location. Lets choose the "Insert" function in "map-scheduler.cc"
- Hit the "debug" button at the top portion of your IDE.
- 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:
- Download the latest version of NetAnim for Windows here
- Unzip the contents of the zip file
- Open the NetAnim.pro file using Qt Creator.
- In Qt Creator , Select "Build All"
- 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.