安装时出现此错误。有人能提出解决方案吗?
^~~~
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++/6/bits/basic_string.h:5628:0,
from /usr/include/c++/6/string:52,
from /usr/include/c++/6/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++/6/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
答案1
第一:请使用2014年10月更新的ns-allinone-2.35_gcc482.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNSGJCZ2YzUGJDVk0/view?usp=sharing即旧的 2011 年 ns-allinone-2.35.tar.gz 适用于 g++-4.4 。
Ubuntu g++-6 无法与 ns2 配合使用。请执行以下操作:$ sudo apt install g++-4.9
(我们偶尔也会发现 Ubuntu g++-5 存在问题。)
然后使用这个构建命令:$export CC=gcc-4.9 CXX=g++-4.9 && ./install