vs2019编译vtk时出现C3848错误

3 篇文章 0 订阅
本文介绍了在使用Visual Studio进行C++编程时遇到的两个编译错误,错误涉及const限定符在函数调用中丢失。解决方法是在vtkLabelHierarchyPrivate.h和vtkLabelHierarchy.cxx文件中相应位置为比较操作符函数添加const修饰,以保持const一致性。通过这些修改,可以成功编译并生成ALL_BUILD目标。
摘要由CSDN通过智能技术生成

错误1:
错误 C3848 具有类型“
const vtkLabelHierarchy::Implementation::PriorityComparator”的表达式会丢失一些 const-volatile 限定符以调用“bool vtkLabelHierarchy::Implementation::PriorityComparator::operator ()(const vtkIdType &,const vtkIdType &)” vtkRenderingLabel D:\Visual Studio 2019\VC\Tools\MSVC\14.24.28314\include\xtree 1683

解决方法:
找到工程 vtkRenderingLabel 下的 vtkLabelHierarchyPrivate.h文件,在第69行加入const,
如:
bool operator () ( const vtkIdType& a, const vtkIdType& b ) const

错误2:
错误 C3848 具有类型“
const vtkLabelHierarchyFullSortIterator::vtkHierarchyNodeSorter”的表达式会丢失一些 const-volatile 限定符以调用“bool vtkLabelHierarchyFullSortIterator::vtkHierarchyNodeSorter::operator ()(const vtkLabelHierarchyFullSortIterator::vtkHierarchyNode &,const vtkLabelHierarchyFullSortIterator::vtkHierarchyNode &)” vtkRenderingLabel D:\Visual Studio 2019\VC\Tools\MSVC\14.24.28314\include\xtree 1708

解决方法:
同理找到vtkLabelHierarchy.cxx 文件,(找不到可以在ctrl + F 搜索类:vtkHierarchyNodeSorter),之后再文件527,528行后加上const,
如:
bool operator()(const vtkHierarchyNode & a,
const vtkHierarchyNode & b) const

修改后返回ALL_BUILD,右键生成,继续编译,便可成功

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值