您的位置:首页 > 其它

Ubuntu14.04下安装NS2.35

2014-12-18 15:15 232 查看
1. 预先安装几个组件:

sudo apt-get install build-essential
sudo apt-get install tcl8.4 tcl8.4-devtk8.4 tk8.4-dev
sudo apt-get install libxmu-dev

2. 命令解压安装包
tar xvfz nsallinone2.31.tar.gz

3. 安装
cd /home/administrator/ns-allinone-2.35
./install

4. 错误解析:
In file included from linkstate/ls.cc:67:0:

linkstate/ls.h: In instantiation of ‘voidLsMap::eraseAll() [with Key = int; T = LsIdSeq]’:

linkstate/ls.cc:396:28: required from here

linkstate/ls.h:137:20: error: ‘erase’ was notdeclared in this scope, and no declarations were found by argument-dependentlookup at the point of instantiation [-fpermissive]

linkstate/ls.h:137:20: note: declarations independent base ‘std::map, std::allocator > >’ are not found byunqualified lookup

linkstate/ls.h:137:20: note: use ‘this->erase’instead

make: *** [linkstate/ls.o] Error 1

Ns make failed!
(1).find -name ls.h
显示出错误的绝对路径:gedit ./ns-2.35/linkstate/ls.h

(2)gedit ./ns-2.35/linkstate/ls.h

(3)在文本编辑器gedit下更改错误:
--错误显示为:void eraseALL{erase(baseMap::begin(),baseMap::end());}
--错误更改提示:note:use ‘this->erase’instead
--方法:gedit下搜索erase(baseMap::begin(),baseMap::end()),然后在文本编辑器gedit里边在erase前加上this->,
变为:voideraseALL{this->erase(baseMap::begin(),baseMap::end());}

更改后保存,重新./install

错误提示:
Ns-allinone package has been installedsuccessfully.

Here are the installation places:

tcl8.5.10:/home/ubuntu/ns-allinone-2.35/{bin,include,lib}

tk8.5.10:/home/ubuntu/ns-allinone-2.35/{bin,include,lib}

otcl: /home/ubuntu/ns-allinone-2.35/otcl-1.14

tclcl: /home/ubuntu/ns-allinone-2.35/tclcl-1.20

ns: /home/ubuntu/ns-allinone-2.35/ns-2.35/ns

nam: /home/ubuntu/ns-allinone-2.35/nam-1.15/nam

xgraph:/home/ubuntu/ns-allinone-2.35/xgraph-12.2

gt-itm: /home/ubuntu/ns-allinone-2.35/itm, edriver, sgb2alt, sgb2ns, sgb2comns,sgb2hierns

----------------------------------------------------------------------------------

Please put/home/ubuntu/ns-allinone-2.35/bin:/home/ubuntu/ns-allinone-2.35/tcl8.5.10/unix:/home/ubuntu/ns-allinone-2.35/tk8.5.10/unix

into your PATH environment; so that you'll beable to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put/home/ubuntu/ns-allinone-2.35/otcl-1.14,/home/ubuntu/ns-allinone-2.35/lib,

into your LD_LIBRARY_PATHenvironment variable.

If it complains about X libraries,add path to your X libraries

into LD_LIBRARY_PATH.

If you are using csh, you can setit like:

setenv LD_LIBRARY_PATH <paths>

If you are using sh, you can setit like:

export LD_LIBRARY_PATH=<paths>

(2) You MUST put /home/ubuntu/ns-allinone-2.35/tcl8.5.10/libraryinto your TCL_LIBRARY environmental

variable. Otherwise ns/nam willcomplain during startup.
(4)环境更改:
按着提示修改环境变量,到home目录下
gedit ~/.bashrc 或者 sudo vim .bashrc
在文件最后加入:
exportPATH="$PATH:/home/administrator/ns-allinone-2.35/bin:/home/administrator/ns-allinone-2.35/tcl8.5.10/unix:/home/administrator/ns-allinone-2.35/tk8.5.10/unix"

exportLD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/administrator/ns-allinone-2.35/otcl-1.14,/home/administrator/ns-allinone-2.35/lib"

exportTCL_LIBRARY="$TCL_LIBRARY:home/administrator/ns-allinone-2.35/tcl8.5.10/library"

注意安装路径的更改

(5)关闭终端,重启终端
输入ns,出现%;
OK!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: