slam14讲ch13代码部分问题解决

当前项目结构
cmake_modules/
├── FindCSparse.cmake
├── FindG2O.cmake
└── FindGlog.cmake
include/    # 头文件
└── myslam
    ├── camera.h
    ├── common_include.h
    └── frame.h
src/     # 源文件
├── camera.cpp
├── CMakeLists.txt
└── frame.cpp
test/   # 测式文件

错误记录

/usr/local/include/glog/vlog_is_on.h:71:4: error: #error <glog/vlog_is_on.h> was not included correctly. See the documentation for how to consume the library.

在对应的src/CMakeLists.txt文件中加入下列代码

find_package(glog REQUIRED)
target_link_libraries(myslam glog::glog)

错误2

In file included from /home/zhouyuxu/Desktop/vslam/myslam/include/myslam/common_include.h:114:0,
                 from /home/zhouyuxu/Desktop/vslam/myslam/include/myslam/camera.h:7,
                 from /home/zhouyuxu/Desktop/vslam/myslam/include/myslam/frame.h:7,
                 from /home/zhouyuxu/Desktop/vslam/myslam/src/frame.cpp:4:
/usr/local/include/glog/logging.h: In constructor ‘google::LogMessage::LogStream::LogStream(google::LogMessage::LogStream&&)’:
/usr/local/include/glog/logging.h:1213:21: error: ‘exchange’ is not a member of ‘std’

编译器版本问题:使用的编译器版本可能不支持 C++14 的标准函数模板。确保您的编译器支持 C++14 标准,并已正确配置。

将父MakeLists.txt中的C++11换成c++14

#set(CMAKE_CXX_FLAGS "-std=c++11 -Wall")
#set(CMAKE_CXX_FLAGS_RELEASE  "-std=c++11 -O3 -fopenmp -pthread")
替换后的
set(CMAKE_CXX_FLAGS "-std=c++14 -Wall")
set(CMAKE_CXX_FLAGS_RELEASE  "-std=c++14 -O3 -fopenmp -pthread")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值