NS2安装(ns2.35 ubuntu20.04)

#ubuntu​ #ns2
Installation of NS2 (ns-2.35) in Ubuntu 20.04 LTS

  • Step 1: Install the basic libraries like
sudo apt install build-essential autoconf automake libxmu-dev
sudo apt-get install build-essential
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev  #for tcl and tk
sudo apt-get install libxmu-dev libxmu-headers  #for nam
  • Step 2: install gcc-4.8 and g+±4.8

open the file using sudo mode

sudo gedit /etc/apt/sources.list

Include the following line

deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe

from—https://blog.csdn.net/qq_42566274/article/details/106399531
//deb http://in.archive.ubuntu.com/ubuntu​ bionic main universe

sudo apt update
sudo apt install gcc-4.8 g++-4.8
  • Step 3:

    Unzip the ns2 packages to home folder

tar zxvf ns-allinone-2.35.tar.gz
cd ns-allinone-2.35/ns-2.35

Modify the following make files:

~ns-2.35/Makefile.in

Change @CC@ to gcc-4.8
change @CXX@ to g++-4.8

~nam-1.15/Makefile.in
~xgraph-12.2/Makefile.in
~otcl-1.14/Makefile.in

Change in all places

@CC@ to gcc-4.8
@CPP@ or @CXX@ to g++-4.8

open the file:
~ns-2.35/linkstate/ls.h

Change at the Line no 137 
void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
to This
void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

All changes made

  • Step 4: Open a new terminal
cd ns-allinone-2.35/
./install
  • Step 5 - Set the PATH

    Open a new Terminal,

gedit .bashrc 

Paste the following lines

export PATH=$PATH:/home/ylx/ns-allinone-2.35/bin:/home/ylx/ns-allinone-2.35/tcl8.5.10/unix:/home/ylx/ns-allinone-2.35/tk8.5.10/unix

export LD_LIBRARY_PATH=/home/ylx/ns-allinone-2.35/otcl-1.14:/home/ylx/ns-allinone-2.35/lib

Logout and Login back
OR

source .bashrc

OVER

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值