How do I Run a .cc File in Ns2

Literally, all of us can run the .cc file in network simulator 2. As an additional note, our research professionals have emphasized required steps in that process.

Create Ns2 Source File in Ubuntu

Initially, we have to create the Ns2 source code program file in the ns-allinone-2.35\ns-2.35 location along with the file extension .cc. Moreover, we have highlighted the Ns2 program source code for antenna configuration.

#include <antenna.h>

static class AntennaClass : public TclClass {


  AntennaClass() : TclClass(“Antenna”) {}

  TclObject* create(int, const char*const*) {

    return (new Antenna);


} class_Antenna;

Run .cc File in Ns2

To run the .cc file in Ns2, we have to modify the Makefile file and add the .cc file name with the location to create the code in .cc file.

Run .cc File in Ns2

Utilization of .cc File in TCL Using Ns2

For the utilization of .cc file in TCL, we have to use the source keyword in Tcl as the code mentioned below.


source  antenna


If you feel that something pulls your leg back while you’re trying by our own then doesn’t get upset with that. Just reach us at any time to get rid off from that.