Tuesday, April 10, 2007

OMNet++ Development in Windows

I use OMNet++ for research purposes mostly in Linux but recently I needed to run it on a Windows environment. The instructions on how to install OMNet++ on Windows are not so useful and it took me a while to get it right. Here are the instructions I followed to get OMNet++ on Windows 2000 and Windows XP.

Windows 2000 preparations

To get an OMNet++ development environment on Windows 2000 it is necessary to have the most recent service pack SP4Express_EN.exe. If you don't have it simply download and install it.

You also need at least version 6.0 SP1 of Internet Explorer that you can download for free here.

If you are using Windows XP make sure you have the newest service pack installed too.

Setting up the development environment

To compile OMNet++ itself and our own models we need a compiler. Fortunately Microsoft is offering free versions of their IDE's (Integrated Development Environments). I will use Visual C++ Express Edition to develop OMNet++ in Windows.

Download and install it from this url. You also need to register your copy that is free and easy to do if you already have a hotmail.com account.

Next Download and install the Platform SDK that contains some needed header files.

Installing OMNet++ binary in Windows

(optional): To get support for images in Neddoc you need to install Ghostscript before installing OMNet++ . Download and install it from here.

Get the OMNeT++ 3.3 win32 binary (exe) from http://www.omnetpp.org/filemgmt/viewcat.php?cid=2 and install it.

(caution1): For some reason the binary available at the OMNet++ web page gives me a CRC error when I execute it. To bypass the CRC check run the installation binary from the command prompt with the /NCRC switch:

c:\> omnetpp-3.3-win32.exe /NCRC

(caution2): When asked for the installation directory make sure to choose a path that has no blank spaces as this may cause some problems when compiling.

During the installation you will be asked for the Ghostscript binary. Select the path were you installed Ghostscript or simply skip if you do not have it installed. Then you will be asked to choose the Visual C++ release you are going to use. If you followed this instructions then you must have Visual C++ 2005 installed so choose vc-81. If you have Visual C++ 2003 (aka 7.1) then choose the vc-71 release. Visual C++ 6.0 is known to have problems when compiling OMNet++ models so upgrade to a newer version of Visual C++ is recommended.

Create a quick launch link (optional)

I like to create a .bat file that sets up the necessary environment variables for OMNet++ development. To do this I simply create an batch file "omnetenv.bat" on the C:\ root that contains the following:

call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"

SET PATH=%PATH%;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
SET INCLUDE=%INCLUDE%;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
SET LIB=%LIB%;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib

The first command is a call to the vcvarsall.bat script that comes with the Visual C++ that sets up all the environment variables needed for C++ development. We also need to add the Platform SDK bin, include and lib directories to the respective environment variables. Make sure to change the directory paths to reflect your installation paths.

To call this omnetenv.bat script I create a desktop shortcut by selecting "Create new shortcut" in the Desktop context menu (i.e. right click) and filling the following items:

Command = %comspec% /k C:\omnetenv.bat
Name = OMNeT++ Development

Clicking on this new shortcut will open a Command Prompt windows (cmd.exe) call the omnetenv.bat script and stay there waiting for input. From this point on we can start developing OMNet++ models. If you are new to OMNet++ then I recommend you to follow the TicToc tutorial.

If you do not have a text editor to code consider using SCiTe.

Mobility Framework in Windows

Once OMNet++ is installed you may consider using the Mobility Framework to develop sensor network and ad hoc network models.

Simply download the Mobility Framework (mobility-fw2.0p3.zip) source code and uncompress it somewhere. Make sure the directory path you choose has no blank spaces in it (i.e. Program Files).

Enter the source directory and edit the mkmk.cmd file and make sure the OMNET_ROOT variable points to the root directory where you installed OMNet++. Make sure you have the OMNet++ development environment setup (i.e. run omnetenv.bat) and run the following commands:

nmake -f Makefile.vc all

This will setup and compile the Mobility Framework. Once it finishes you can proceed to create Mobility Framework models using the template files and the Makefile.gen file as described in the documentation.


  1. I have followed all steps as described in this blog but when i run the existing network examples i get Errror in moudle. For example when i run
    FloodNetwork by using opp_nmakemake and nmake -f makefile.vc
    this message appears at *run time*

    //////Error in module (FloodNetwork) floodSim: Module type definition
    ChannelControl not found (Define_Module() missing from C++ code?)

    please suggest how to tackle it?

  2. Anonymous2:00 PM

    I've been struggling to make the windows XP fetch the header and library file from their designated folder BUT failed. So, I copied all header files (*.h) and library files (*.lib) into the OMNeT++ include and lib directory respectively. And it works superbly.

  3. After the following attempts steps i get error,
    C:\OMNeT++\samples>cd my_example1

    C:\OMNeT++\samples\my_example1>opp_nmakemake -f
    Creating Makefile.vc in C:/OMNeT++/samples/my_example1...
    Makefile.vc created.
    Please type `nmake -f Makefile.vc depend' NOW to add dependencies!

    C:\OMNeT++\samples\my_example1>nmake -f Makefile.vc depend

    Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    Copyright (C) Microsoft Corporation. All rights reserved.

    NMAKE : fatal error U1073: don't know how to make '-f'


    "vcvars32.bat" contains the following lines:


    even after executing it gives error U1073.

    Pls suggest


  4. This seems to be a problem with you nmake version. Maybe you have another nmake somewhere (cygwin??) and not the VC one.

    Try using "nmake /f" instead of "nmake -f". This is all I can tell as I no longer have OMNet installed for testing.

  5. Thanks 龍神,

    I got the simulation working, thanks for your comments and its working now. Sorry for the late reply.

  6. Anonymous5:58 PM

    by following the step omnet++(Version 4) is working fine at windowsXp. But i am not able to make mobility feature working. downloaded mobility-fw2.0p3 and when i try to execute mkmk.cmd. Gettin error namke.e is not in the path. But i set the path of omnet inisde the mkmk file.. But same problem.. Please suggest...

  7. I can only think of two reasons why nmake cannot be found. One is that you have no Visual Studio installed. If you don't then install one of the express versions of Visual Studio.

    If you have Visual Studio installed then make sure you are running the Visual Studio console and not the normal cmd.exe console. Usualy in the start menu inside the Visual Studio direcotry there is a command prompt link that when executed also sets some environment variables that allow the console to find Visual Studio utils and libraries. Use that link instead of the cmd.exe.

  8. The comment "nmake -f" solved the issue, earlier I had issues with the OMNeT++3.3 working, as I had selected VC++ release8.0 with VB6.0install instead of VC++ relase6.0.

    Thanks for the post..