github/basalt/thirdparty/Pangolin/src/image/image_io_lz4.cpp:42:12: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Werror=stringop-truncation]
strncpy(header.magic,"LZ4",3); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
这个报错是由于在CMake的C++编译选项中添加了-Werror,即将所有警告当作错误对待,这个strncpy函数,由于是C风格的函数,拷贝字符串后面没有加’ ’这个结束符,但是这里其实不需要加结束符,因此在项目中全文搜索-Werror的位置,然后空一格在后面加上-Wno-error=stringop-truncation就行。
In file included from XXX/github/basalt/thirdparty/basalt-headers/thirdparty/eigen/Eigen/src/Geometry/AlignedBox.h:49, from XXX/github/basalt/thirdparty/Pangolin/include/pangolin/plot/range.h:43, from XXX/github/basalt/thirdparty/Pangolin/include/pangolin/image/image_utils.h:34, from XXX/github/basalt/thirdparty/Pangolin/include/pangolin/handler/handler_image.h:30, from /home/vipl/VIPL2021-CJ/github/basalt/thirdparty/Pangolin/src/handler/handler_image.cpp:1: /home/vipl/VIPL2021-CJ/github/basalt/thirdparty/basalt-headers/thirdparty/eigen/Eigen/src/Geometry/InternalHeaderCheck.h:2:2: error: #error "Please include Eigen/Geometry instead of including headers inside the src directory directly." #error "Please include Eigen/Geometry instead of including headers inside the src directory directly."
这个报错是因为代码中检查了是否直接包含AlignedBox.h,即在range.h中直接使用了
#include
然后在AlignedBox.h中,有一个#include "./InternalHeaderCheck.h"直接检查了出来。
因此报错了,需要将range.h中的
#include修改为 #include



