4
發生了一些奇怪的事情:我沒有修改我的ns3 C++代碼的任何部分,並且運行編譯這是錯誤出現:ns3,C++,儘管被用作'typeid'的操作數,但仍會評估帶有副作用的表達式:
[ 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.
我不明白爲什麼會出現這個錯誤。奇怪的是,我正在兩個不同的目錄中使用兩個類似的代碼,並且兩者都出現錯誤,但我沒有修改任何內容。可能是編譯器的問題?任何建議?