ORB_SLAM安装问题error: ‘std::chrono::monotonic_clock’ has not been declared
生活随笔
收集整理的這篇文章主要介紹了
ORB_SLAM安装问题error: ‘std::chrono::monotonic_clock’ has not been declared
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
出現(xiàn)這個(gè)問題的原因是C++版本之間存在區(qū)別。
在C++11版里已經(jīng)沒有momotonic_clock了,有steady_clock作為替代。
我是在這里得到解決思路的:c++ - ‘std::chrono::monotonic_clock’ has not been declared - Stack Overflow
所以orb-slam的作者在代碼中使用了ifdef來判斷用戶的C++版本(大概是這個(gè)意思):
#ifdef COMPILEDWITHC11std::chrono::steady_clock::time_point t1 = std::chrono::steady_clock::now(); #elsestd::chrono::monotonic_clock::time_point t1 = std::chrono::monotonic_clock::now(); #endif//Pass the image to the SLAM systemSLAM.TrackMonocular(im,tframe);#ifdef COMPILEDWITHC11std::chrono::steady_clock::time_point t2 = std::chrono::steady_clock::now(); #elsestd::chrono::monotonic_clock::time_point t2 = std::chrono::monotonic_clock::now(); #endif但是monotonic_clock這部分依然會(huì)報(bào)錯(cuò)!
如果你這部分報(bào)錯(cuò)了,大概率你的C++是11版本,那么我們其實(shí)可以刪掉這部分判斷語(yǔ)句,只保留
std::chrono::steady_clock::time_point t1 = std::chrono::steady_clock::now();//Pass the image to the SLAM systemSLAM.TrackMonocular(im,tframe);std::chrono::steady_clock::time_point t2 = std::chrono::steady_clock::now();//......這部分就行,把monotonic_clock的代碼刪掉之后就能正常編譯了!
參考鏈接
總結(jié)
以上是生活随笔為你收集整理的ORB_SLAM安装问题error: ‘std::chrono::monotonic_clock’ has not been declared的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: top99 slam
- 下一篇: 安装orb_slam 的坑解决方法