转自:http://blog.sina.com.cn/s/blog_b0992ce90101apqu.html
step 1:下载ns2.35
http://sourceforge.net/projects/nsna...ar.gz/download,解压
step 2:安装依赖包
sudo apt-get install tcl8.5-dev tk8.5-dev
sudo apt-get install gcc-4.4 g++-4.4
sudo apt-get install build-essential autoconf automake
sudo apt-get install perl xgraph libxt-dev libx11-devlibxmu-dev
step 3 进入 ns-allinone-2.35 在终端./install安装
stpe 4修改环境变量。这个网上很多自己找吧
在/home/xxx/下 gedit .bashrc
添加代码如下:
#LD_LIBRARY_PATHOTCL_LIB=/home/huangtaya/ns-allinone-2.35/otcl-1.14NS2_LIB=/home/huangtaya/ns-allinone-2.35/libX11_LIB=/usr/X11R6/libUSR_LOCAL_LIB=/usr/local/libexportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB# TCL_LIBRARYTCL_LIB=/home/huangtaya/ns-allinone-2.35/tcl8.5.10/libraryUSR_LIB=/usr/libexport TCL_LIBRARY=$TCL_LIB:$USR_LIB# PATHXGRAPH=/home/huangtaya/ns-allinone-2.35/bin:/home/huangtaya/ns-allinone-2.35/tcl8.5.10/unix:/home/huangtaya/ns-allinone-2.35/tk8.5.10/unix# Note: the above two lines starting from XGRAPH should come in thesame lineNS=/home/huangtaya/ns-allinone-2.35/ns-2.35/NAM=/home/huangtaya/ns-allinone-2.34/nam-1.15/PATH=$PATH:$XGRAPH:$NS:$NAM
可惜我在第三步时,出现错误
linkstate/ls.cc:396:28: required from here
linkstate/ls.h:137:20: error: ‘erase’ was not declared in thisscope, and no declarations were found by argument-dependent lookupat the point of instantiation [-fpermissive]
linkstate/ls.h:137:20: note: declarations in dependent base‘std::map<int, LsIdSeq,std::less<int>,std::allocator<std: air<constint, LsIdSeq> > >’ arenot found by unqualified lookup
linkstate/ls.h:137:20: note: use ‘this->erase’instead
make: *** [linkstate/ls.o] Error 1
Ns make failed!
于是再次安装,这次在 ns-allinone-2.35目录下输入exportCC=gcc-4.4 CXX=g++-4.4 &&./install
安装还是不成功
于是把解压的 ns-allinone-2.35删除,再次解压。再在 ns-allinone-2.35下输入 exportCC=gcc-4.4 CXX=g++-4.4 &&./install
这次安装成功
如果还是不成功可以该ls.h文件的代码
void eraseAll() { erase(baseMap::begin(), baseMap::end()); } 改为:void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }