码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • NS2安装及入门实例——(ns2.35 / Ubuntu20.04)


    文章目录

    • 一、ns2安装
      • 1、更新系统源
      • 2、准备工作
      • 3、下载安装包
      • 4、安装
      • 5、问题
        • ① 问题1
        • ② 问题2
        • ③ 问题3
      • 6、安装成功
      • 7、环境配置
    • 二、nam安装
      • 1、安装
      • 2、问题
    • 三、实例

    一、ns2安装

    1、更新系统源

    sudo apt-get update
    sudo apt-get upgrade
    
    • 1
    • 2

    2、准备工作

    sudo apt-get install build-essential
    sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev
    sudo apt-get install libxmu-dev libxmu-headers
    
    • 1
    • 2
    • 3

    3、下载安装包

    官网下载地址:http://www.isi.edu/nsnam/ns/

    点击 allinone

    在这里插入图片描述

    点击 current release 2.35

    在这里插入图片描述

    安装 ns-allinone-2.35.tar.gz

    4、安装

    sudo tar -zxvf ~/下载/ns-allinone-2.35.tar.gz -C /usr/local/
    cd /usr/local
    sudo mv ./ns-allinone-2.35 ./ns2
    sudo chown -R hadoop:hadoop ./ns2
    cd ns2
    ./install
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    5、问题

    ① 问题1

    linkstate/ls.h:137:20: note: use ‘this->erase’ instead
    make: *** [linkstate/ls.o] Error 1
    Ns make failed!
    
    • 1
    • 2
    • 3

    解决:

    137行:
    void eraseAll() { erase(baseMap::begin(), baseMap::end()); } 
    -> 
    void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
    
    • 1
    • 2
    • 3
    • 4

    ② 问题2

    mdart/mdart_adp.cc:108:21: error: reference to ‘hash’ is ambiguous
    
    • 1

    在这里插入图片描述
    解决:

    sudo vim ns-2.35/mdart/mdart_function.h
    230行:hash -> hash_o
    sudo vim ns-2.35/mdart/mdart_adp.cc
    108行:hash -> hash_o
    396行:hash -> hash_o
    
    • 1
    • 2
    • 3
    • 4
    • 5

    ③ 问题3

    In file included from common/tkAppInit.cc:57:0:
    ./bitmap/play.xbm:5:74: error: narrowing conversion of ‘252’ from ‘int’ to ‘char’ inside
    
    • 1
    • 2

    解决:全部加上 (char)
    在这里插入图片描述

    6、安装成功

    在这里插入图片描述

    7、环境配置

    vim ~/.bashrc
    source ~/.bashrc
    
    • 1
    • 2

    加入一下配置:

    export NS_HOME=/usr/local/ns2
    export TK_HOME=$NS_HOME/tk8.5.10
    export TCl_HOME=$NS_HOME/tcl8.5.10
    
    export PATH=$PATH:$NS_HOME/bin:$TK_HOME/unix:$TCL_HOME/unix
    export LD_LIBRARY_PATH=$NS_HOME/otcl-1.14:$NS_HOME/lib
    export TCL_LIBRARY=$TCL_HOME/library
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    输入 ns,进入成功:
    在这里插入图片描述

    二、nam安装

    1、安装

    cd /usr/local/ns2/nam-1.15
    ./configure
    make
    sudo make install
    
    • 1
    • 2
    • 3
    • 4

    2、问题

    configure: error: Installation of tcl seems incomplete or can't be found automatically.
    Please correct the problem by telling configure where tcl is
    using the argument --with-tcl=/path/to/package
    (perhaps after installing it),
    or the package is not required, disable it with --with-tcl=no.
    
    • 1
    • 2
    • 3
    • 4
    • 5

    解决:

    sudo ./configure --with-tcl=/home/文件目 录/ns/tcl8.5.10 --with-tcl-ver=8.5.10 --with-tk=/home/文件目录/ns/tk8.5.10 --with-tk-ver=8.5.10
    
    • 1

    三、实例

    cd /usr/local/ns2/ns-2.35/tcl/ex
    ns simple.tcl
    
    • 1
    • 2

    在这里插入图片描述

  • 相关阅读:
    Linux 对整个系统备份和还原
    Arrays.asList() 和 Collections.singletonList()
    利用Vite或者webpack创建(打包)Vue项目,并启动Vue项目
    [CMD]常用命令
    数据链路层主要问题及源于课本的答案
    2023年5月CSDN客服月报|解决5个重大问题和18个次要问题,采纳1个用户建议,处理2个用户需求
    API接口自动化测试
    vue3 defineExpose 显示的指定组件需要暴露的属性
    SpringBoot自动配置入门
    Baumer工业相机堡盟工业相机如何通过NEOAPI SDK实现根据每次触发信号移动感兴趣区域ROI(C++)
  • 原文地址:https://blog.csdn.net/WZRbeliever/article/details/132603271
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号