ubuntu16.04安装NS2出现问题及解决办法

NS2安装与使用: 下载NS2软件包到工作目录,

地址http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.33.tar.gz

解压tar -zxf ns-allinone-2.33.tar.gz

cd ns-allinone-2.33

./install

 

问题1:

fatal error: X11/Xlib.h: 没有那个文件或目录 compilation terminated. 

解决办法:

安装X11,命令为    sudo apt -get install libx11-dev 

问题2:

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]

linkstate/ls.h:137:20: note: declarations in dependent base ‘std::map, std::allocator > >’ are not found by unqualified lookup
linkstate/ls.h:137:20: note: use ‘this->erase’ instead
make: *** [linkstate/ls.o] Error 1
Ns make failed

解决办法:

修改ls文件:ns-2.35/linkstate/ls.h

第137行

void eraseAll() { erase(baseMap::begin(), baseMap::end()); }

改为:void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

然后重新 ./install,安装完成!

ubuntu16.04安装NS2出现问题及解决办法

参考https://www.linuxidc.com/Linux/2013-05/84032p3.htm

问题2:

没有nam

安装nam
   cd ns-allinone-2.35/ns-2.35
   ./configure
   make
   sudo make install

.configure时出现错误

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

解决办法:

./configure --with-tcl-ver=8.5
之后的验证参考https://blog.****.net/qiushye/article/details/53082096