ns3,c ++,尽管被用作'typeid'

时间:2015-09-26 17:19:28

标签: c++ callback ns-3

发生了一些奇怪的事情:我没有修改我的ns3 c ++代码的任何部分,并且运行编译这是出现的错误:

[ 815/1681] cxx: scratch/initial-scenario.cc -> build/scratch/initial-scenario.cc.1.o
In file included from ../scratch/initial-scenario.cc:3:
In file included from ./ns3/core-module.h:18:
In file included from ./ns3/calendar-scheduler.h:24:
In file included from ./ns3/scheduler.h:25:
In file included from ./ns3/object.h:29:
In file included from ./ns3/object-base.h:23:
In file included from ./ns3/type-id.h:25:
In file included from ./ns3/trace-source-accessor.h:24:
./ns3/callback.h:1244:54: error: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Werror,-Wpotentially-evaluated-expression]
                        "got=" << Demangle ( typeid (*other).name () ) << std::endl <<
                                                     ^
./ns3/fatal-error.h:98:32: note: expanded from macro 'NS_FATAL_ERROR'
      std::cerr << "msg=\"" << msg << "\", ";           \
                               ^
1 error generated.

我不明白为什么会出现这个错误。奇怪的是,我在两个不同的目录中使用两个相似的代码,错误出现在两者中,但我没有修改任何东西。可能是编译器的问题?有什么建议吗?

1 个答案:

答案 0 :(得分:1)

我按照此处的建议解决了问题:https://www.nsnam.org/wiki/Ns-3.24-errata

问题与Xcode 7.0的更新有关