C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 2338|回复: 1

[技术讨论] ubuntu 18.04 安装ns2 [复制链接]

军衔等级:

亚星游戏官网-yaxin222  新兵

注册:2019-3-11
发表于 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:/a79ea873-e943-412a-8ce0-84cb29a0108b[/img]


需切换gcc版本
[img]blob:/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-5 14:47 , Processed in 1.127220 second(s), 16 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图