![我目前所做的](https://linux22.com/image/1019687/%E6%88%91%E7%9B%AE%E5%89%8D%E6%89%80%E5%81%9A%E7%9A%84.png)
大学计算机网络课程要求安装 Network Simulator 2。但我费了很大劲才安装成功。
我目前所做的
已从以下位置下载 ns2 二进制文件这里
已执行这些命令(基本上安装所需的依赖项)
sudo apt-get install gcc
sudo apt-get install make
sudo apt-get install libx11-dev
sudo apt-get install xorg-dev
- 已执行这些命令来安装软件
tar xvfzns-allinone-2.35.tar.gz
cd ns-allinone-2.35
sudo ./install
问题
到目前为止,编译过程都很顺利:
mdart/mdart_adp.cc: In member function ‘void ADP::sendDarq(nsaddr_t, int)’:
mdart/mdart_adp.cc:108:21: error: reference to ‘hash’ is ambiguous
nsaddr_t dstAdd_ = hash(reqId);
^~~~
In file included from ./mdart/mdart.h:52:0,
from ./mdart/mdart_adp.h:51,
from mdart/mdart_adp.cc:47:
./mdart/mdart_function.h:230:17: note: candidates are: nsaddr_t hash(nsaddr_t)
inline nsaddr_t hash(nsaddr_t id) {
^~~~
In file included from /usr/include/c++/7/bits/basic_string.h:6587:0,
from /usr/include/c++/7/string:52,
from /usr/include/c++/7/bitset:47,
from ./mdart/mdart_function.h:62,
from ./mdart/mdart.h:52,
from ./mdart/mdart_adp.h:51,
from mdart/mdart_adp.cc:47:
/usr/include/c++/7/bits/functional_hash.h:58:12: note: template<class _Tp> struct std::hash
struct hash;
^~~~
mdart/mdart_adp.cc: In member function ‘void ADP::sendDaup()’:
mdart/mdart_adp.cc:396:21: error: reference to ‘hash’ is ambiguous
nsaddr_t dstAdd_ = hash(mdart_->id_);
^~~~
In file included from ./mdart/mdart.h:52:0,
from ./mdart/mdart_adp.h:51,
from mdart/mdart_adp.cc:47:
./mdart/mdart_function.h:230:17: note: candidates are: nsaddr_t hash(nsaddr_t)
inline nsaddr_t hash(nsaddr_t id) {
^~~~
In file included from /usr/include/c++/7/bits/basic_string.h:6587:0,
from /usr/include/c++/7/string:52,
from /usr/include/c++/7/bitset:47,
from ./mdart/mdart_function.h:62,
from ./mdart/mdart.h:52,
from ./mdart/mdart_adp.h:51,
from mdart/mdart_adp.cc:47:
/usr/include/c++/7/bits/functional_hash.h:58:12: note: template<class _Tp> struct std::hash
struct hash;
^~~~
Makefile:93: recipe for target 'mdart/mdart_adp.o' failed
make: *** [mdart/mdart_adp.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
我见过这Stack Overflow 上的问题,我尝试了建议的解决方案,但对我不起作用。有人可以指导我该怎么做吗?我一周后要考试,情况很紧急。
答案1
Ubuntu 18.04,只需执行以下操作:sudo apt install g++-4.8
https://packages.ubuntu.com/search?suite=default§ion=all&arch=any&keywords=g%2B%2B-4.8&searchon=names...请注意,您可以同时安装任意数量的 gcc 版本。其他示例https://drive.google.com/drive/folders/1xVEATaYAwqvseBzYxKDzJoZ4-Hc_XOJm?usp=sharing
构建 ns-2.35:
tar xvf ns-allinone-2.35_gcc5.tar.gz (2014 update)
https://drive.google.com/file/d/0B7S255p3kFXNVVlxR0ZNRGVORjQ/view?usp=sharing
cd ns-allinone-2.35/
export CC=gcc-4.8 CXX=g++-4.8 && ./install
cd ns-2.35/
sudo make install