1、下载mit.tar.gz
2、把mit.tar.gz放在ns-allinone-2.27/ns-2.27下面
3、解压mit.tar.gz
tar xvfz mit.tar.gz
4、修改makefile文件。
在makefile中的DEFINE后面添加-DMIT_uAMPS;在INCLUDES = \后添加
- I./mit/rca -I./mit/uAMPS
再找到OBJ_CC = \后面也跟了一大串,串的末尾是$(OBJ_STL),
在它之上填上
mit/rca/energy.o mit/rca/rcagent.o \
mit/rca/rca-ll.o mit/rca/resource.o \
mac/mac-sensor-timers.o mac/mac-sensor.o \
mit/uAMPS/bsagent.o \
5、修改环境变量
export RCA_LIBRARY=$(ns的安装目录)/mit/rca
export uAMPS_LIBRARY=$(ns的安装目录)/mit/uAMPS
6、清除以前的编译结果
make clean
7、重新编译
make
8、如果编译通过,执行ns-2.27下的./leach_test就可以运行得到结果。
安装成功后在\cygwin\home\xxx\ns-allinone-2.27\ns-2.27\mit\leach_sims目录下的leach.err中会有下面的数据
INITIALIZE THE LIST xListHead
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 222.8
SORTING LISTS ...DONE!
转载于:https://blog.51cto.com/ftdgg/909844