c++point-cloud-librarypoint-cloudsoctree

Point Cloud Library Octree lib generating error


I get this error just by including the header file to my code. I'm using visual studio 2019 and c++17, I've included the linker files and all but it doesn't want to work.

What could it be?

Error C4996 'std::iterator<std::forward_iterator_tag,const pcl::octree::OctreeNode,void,const pcl::octree::OctreeNode *,const pcl::octree::OctreeNode &>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. TCC2 D:\dev\CMake\vcpkg\installed\x64-windows\include\pcl\octree\octree_iterator.h 71


Solution

  • It is a warning for using deprecated code and Visual Studio treat it as error by default.

    Go to project properties -> Configuration Properties -> C/C++ -> General -> SDL checks -> set to No. And it should be good.