通信人家园

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索

军衔等级:

  新兵

注册:2019-3-11
跳转到指定楼层
1#
发表于 2024-7-11 17:19:04 |只看该作者 |倒序浏览
安装所需的包(可做可不做,后边安装ns2 会自动安装)
[size=0.9em]sudo apt-get install build-essential
[size=0.9em]sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev
[size=0.9em]sudo apt-get install libxmu-dev libxmu-headers


下载ns2 安装包
http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download


解压在当前文件夹
[size=0.9em]tar -xzf ns-allinone-2.35.tar.gz
[size=0.9em]

进入文件夹
cd [size=0.9em]ns-allinone-2.35
[size=0.9em]

[size=0.9em]sudo ./install

报错1
[size=0.9em]linkstate/ls.cc:396:28:   required from here
[size=0.9em]linkstate/ls.h:137:25: error: ‘erase’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
[size=0.9em]  void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
[size=0.9em]                         ^
[size=0.9em]linkstate/ls.h:137:25: note: declarations in dependent base ‘std::map<int, LsIdSeq, std::less<int>, std::allocator<std::pair<const int, LsIdSeq> > >’ are not found by unqualified lookup
[size=0.9em]linkstate/ls.h:137:25: note: use ‘this->erase’ instead
[size=0.9em]Makefile:93: recipe for target 'linkstate/ls.o' failed
[size=0.9em]make: *** [linkstate/ls.o] Error 1
[size=0.9em]Ns make failed!
[size=0.9em]See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Open the file ls.cc (in my case, it was ls.h) in [backcolor=var(--black-200)]ns-2.xx/linkstate directory. Change the 137th line ie. as follows from


[color=var(--black-600)][backcolor=var(--highlight-bg)]void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
[backcolor=var(--highlight-bg)]

[color=var(--black-600)][backcolor=var(--highlight-bg)]to
[backcolor=var(--highlight-bg)]

[color=var(--black-600)][backcolor=var(--highlight-bg)]void eraseAll() {baseMap::erase(baseMap::begin(), baseMap::end()); }

报错2
[img]blob:https://www.txrjy.com/a79ea873-e943-412a-8ce0-84cb29a0108b[/img]


需切换gcc版本
[img]blob:https://www.txrjy.com/e9de4042-87bf-4d56-84cb-5bf770305638[/img]


[size=13.333333px]sudo apt install g++-4.8
[size=13.333333px]export CC=gcc-4.8 CXX=g++-4.8 && ./install
[size=13.333333px]



设置环境变量


[size=0.9em]cd ~
[size=0.9em]ls -a
[size=0.9em]vim .bashrc




[size=0.9em]export PATH="$PATH:/home/安装文件夹名/ns-allinone-2.35/bin:/home/安装文件夹名/ns-allinone-2.35/tcl8.5.10/unix:/home/安装文件夹名/ns-allinone-2.35/tk8.5.10/unix"
[size=0.9em]export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/安装文件夹名/ns-allinone-2.35/otcl-1.14:/home/安装文件夹名/ns-allinone-2.35/lib"
[size=0.9em]export TCL_LIBRARY="$TCL_LIBRARY:/home/安装文件夹名/ns-allinone-2.35/tcl8.5.10/library"


[size=0.9em]source ~/.bashrc
[size=0.9em]

[size=0.9em]安装失败
[size=0.9em]$ns
[size=0.9em]Command 'ns' not found, but can be installed with:
[size=0.9em]sudo apt install ns2

[size=0.9em]安装成功
[size=0.9em]$ ns
[size=0.9em]%


[size=0.9em]cd ./ns-allinone-2.35/ns-2.35/tcl/ex
[size=0.9em]ns example.tcl

举报本楼

本帖有 1 个回帖,您需要登录后才能浏览 登录 | 注册
您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系我们 |网站地图  

GMT+8, 2024-11-17 02:31 , Processed in 0.415249 second(s), 16 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部