编译错误信息:
CXX otbr_agent-otubus.o
In file included from ../../third_party/openthread/repo/src/core/thread/key_manager.hpp:45:0,
from ../../third_party/openthread/repo/src/core/meshcop/meshcop_tlvs.hpp:54,
from ../../third_party/openthread/repo/src/core/thread/network_diagnostic_tlvs.hpp:46,
from otubus.cpp:43:
../../third_party/openthread/repo/src/core/common/timer.hpp:77:40: error: 'Time' has not been declared
static const uint32_t kMaxDelay = (Time::kMaxDuration >> 1);
^~~~
../../third_party/openthread/repo/src/core/common/timer.hpp:110:5: error: 'Time' does not name a type; did you mean 'Timer'?
Time GetFireTime(void) const { return mFireTime; }
^~~~
Timer
../../third_party/openthread/repo/src/core/common/timer.hpp:132:52: error: 'Time' has not been declared
bool DoesFireBefore(const Timer &aSecondTimer, Time aNow);
^~~~
../../third_party/openthread/repo/src/core/common/timer.hpp:137:5: error: 'Time' does not name a type; did you mean 'Timer'?
Time mFireTime;
^~~~
Timer
../../third_party/openthread/repo/src/core/common/timer.hpp: In constructor 'ot::Timer::Timer(ot::Instance&, ot::Timer::Handler, void*)':
../../third_party/openthread/repo/src/core/common/timer.hpp:99:11: error: class 'ot::Timer' does not have any field named 'mFireTime'
, mFireTime()
^~~~~~~~~
../../third_party/openthread/repo/src/core/common/timer.hpp: At global scope:
../../third_party/openthread/repo/src/core/common/timer.hpp:176:18: error: 'TimeMilli' has not been declared
void StartAt(TimeMilli sStartTime, uint32_t aDelay);
^~~~~~~~~
../../third_party/openthread/repo/src/core/common/timer.hpp:190:12: error: 'TimeMilli' does not name a type; did you mean 'TimerMilli'?
static TimeMilli GetNow(void) { return TimeMilli(otPlatAlarmMilliGetNow()); }
^~~~~~~~~
TimerMilli
Makefile:848: recipe for target 'otbr_agent-otubus.o' failed
发现openthread/third_party/openthread/repo/src/core/thread/network_diagnostic_tlvs.hpp文件中包含#include "meshcop/meshcop_tlvs.hpp"且没有使用;
发现openthread/third_party/openthread/repo/src/core/meshcop/meshcop_tlvs.hpp文件中递归包含common/timer.hpp造成编译错误;
解决方法:
删除或屏蔽openthread/third_party/openthread/repo/src/core/thread/network_diagnostic_tlvs.hpp文件中的#include "meshcop/meshcop_tlvs.hpp
编译成功。