Jan 29, 2013

Compile threshold.cc in NS2


In ns2, if you want to calculate the receiving power threshold of a node, you may want to use threshold tool which has been integrated in ns2 source code.

I don`t know why the threshold.cc is not compiled in the new version of ns2 like ns-allinone-2.35. So we have to do it by ourselves. In ubuntu, if you try to do "gcc threshold.cc", you will get an error message of "<iostream.h>".

So, we replace this line "#include<iostream.h>" by

#include<iostream>

#include<cstring>

using namespace std;


Then, compile it with g++,

g++ threshold.cc -o threshold

7 comments:

  1. thanks a lot <3

    ReplyDelete
  2. threshold -m TwoRayGround -r 0.95 40
    it gives error that threshold:command not found.

    ReplyDelete
    Replies
    1. the correct is ./threshold -m TwoRayGround -r 0.95 40

      Delete
  3. its working, thanks a lot............

    ReplyDelete
  4. Plz anybody tell me,
    In the following statement used for defining frequency in Hz, what is the meaning of "e"

    "double freq = 914.0e6; // frequency"

    ReplyDelete
    Replies
    1. Hi Pooja,

      Sorry to reply you so late. I got a bunch of comments to reply. Here it means 914 * 10^6 which is 914MHz.

      Delete