栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

编译basalt时出现的报错

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

编译basalt时出现的报错

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 
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/948349.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号