Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors with recent compilers and C++17/20 standard #394

Merged
merged 1 commit into from
May 23, 2023

Conversation

SpaceIm
Copy link
Contributor

@SpaceIm SpaceIm commented May 2, 2023

octomap fails to compile with recent compilers when I enable C++20 standard:

gcc12/C++20
octomap/1.9.7: Building from source
octomap/1.9.7: Package octomap/1.9.7:e9554f9728649ff86b11b47e22e41252ff0c68eb
octomap/1.9.7: Copying sources to build folder
octomap/1.9.7: Building your package in /home/spaceim/.conan2/p/t/octom737ff965347f3/b
octomap/1.9.7: Calling generate()
octomap/1.9.7: Generators folder: /home/spaceim/.conan2/p/t/octom737ff965347f3/b/build/Release/generators
octomap/1.9.7: CMakeToolchain generated: conan_toolchain.cmake
octomap/1.9.7: CMakeToolchain generated: CMakePresets.json
octomap/1.9.7: CMakeToolchain generated: ../../../src/CMakeUserPresets.json
octomap/1.9.7: Generating aggregated env files
octomap/1.9.7: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
octomap/1.9.7: Calling build()
octomap/1.9.7: Running CMake.configure()
octomap/1.9.7: RUN: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="/home/spaceim/.conan2/p/t/octom737ff965347f3/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/spaceim/.conan2/p/t/octom737ff965347f3/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap"
-- Using Conan toolchain: /home/spaceim/.conan2/p/t/octom737ff965347f3/b/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: C++ Standard 20 with extensions OFF
-- Conan toolchain: Setting BUILD_SHARED_LIBS = ON
-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-12 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-12 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done


-- octomap building as Release
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)


-- Compile octomap using: make
-- Install octomap using: make install
--     (be sure to set the correct CMAKE_INSTALL_PREFIX before)
-- Compile API-documentation using: make docs

-- Configuring done (7.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/spaceim/.conan2/p/t/octom737ff965347f3/b/build/Release

octomap/1.9.7: Running CMake.build()
octomap/1.9.7: RUN: cmake --build "/home/spaceim/.conan2/p/t/octom737ff965347f3/b/build/Release" -- -j8
[4/16] Building CXX object src/CMakeFiles/octomap.dir/CountingOcTree.cpp.o
FAILED: src/CMakeFiles/octomap.dir/CountingOcTree.cpp.o
/usr/bin/g++-12 -Doctomap_EXPORTS -I/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include -m64 -Wall  -Wextra -Wpedantic -O3 -funroll-loops -DNDEBUG -std=c++20 -fPIC -MD -MT src/CMakeFiles/octomap.dir/CountingOcTree.cpp.o -MF src/CMakeFiles/octomap.dir/CountingOcTree.cpp.o.d -o src/CMakeFiles/octomap.dir/CountingOcTree.cpp.o -c /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/CountingOcTree.cpp
In file included from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBaseImpl.h:83,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:38,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/CountingOcTree.h:39,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/CountingOcTree.cpp:35:
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeIterator.hxx:42:39: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
   42 |     class iterator_base : public std::iterator<std::forward_iterator_tag, NodeType>{
      |                                       ^~~~~~~~
In file included from /usr/include/c++/12/bits/stl_algobase.h:65,
                 from /usr/include/c++/12/list:60,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBaseImpl.h:38:
/usr/include/c++/12/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:46:22: error: expected unqualified-id before ‘double’
   46 |     OcTreeBase<NODE>(double res) : OcTreeBaseImpl<NODE,AbstractOcTree>(res) {};
      |                      ^~~~~~
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:46:22: error: expected ‘)’ before ‘double’
   46 |     OcTreeBase<NODE>(double res) : OcTreeBaseImpl<NODE,AbstractOcTree>(res) {};
      |                     ~^~~~~~
      |                      )
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/CountingOcTree.cpp: In constructor ‘octomap::CountingOcTree::CountingOcTree(double)’:
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/CountingOcTree.cpp:53:50: error: no matching function for call to ‘octomap::OcTreeBase<octomap::CountingOcTreeNode>::OcTreeBase(double&)’
   53 |    : OcTreeBase<CountingOcTreeNode>(in_resolution) {
      |                                                  ^
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:44:9: note: candidate: ‘octomap::OcTreeBase<octomap::CountingOcTreeNode>::OcTreeBase(const octomap::OcTreeBase<octomap::CountingOcTreeNode>&)’
   44 |   class OcTreeBase : public OcTreeBaseImpl<NODE,AbstractOcTree> {
      |         ^~~~~~~~~~
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:44:9: note:   no known conversion for argument 1 from ‘double’ to ‘const octomap::OcTreeBase<octomap::CountingOcTreeNode>&’
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:44:9: note: candidate: ‘octomap::OcTreeBase<octomap::CountingOcTreeNode>::OcTreeBase(octomap::OcTreeBase<octomap::CountingOcTreeNode>&&)’
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:44:9: note:   no known conversion for argument 1 from ‘double’ to ‘octomap::OcTreeBase<octomap::CountingOcTreeNode>&&’
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h: In instantiation of ‘octomap::OcTreeBase<NODE>* octomap::OcTreeBase<NODE>::create() const [with NODE = octomap::CountingOcTreeNode]’:
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:50:23:   required from here
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:50:46: error: no matching function for call to ‘octomap::OcTreeBase<octomap::CountingOcTreeNode>::OcTreeBase(const double&)’
   50 |     OcTreeBase<NODE>* create() const {return new OcTreeBase<NODE>(this->resolution); }
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:44:9: note: candidate: ‘octomap::OcTreeBase<octomap::CountingOcTreeNode>::OcTreeBase(const octomap::OcTreeBase<octomap::CountingOcTreeNode>&)’
   44 |   class OcTreeBase : public OcTreeBaseImpl<NODE,AbstractOcTree> {
      |         ^~~~~~~~~~
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:44:9: note:   no known conversion for argument 1 from ‘const double’ to ‘const octomap::OcTreeBase<octomap::CountingOcTreeNode>&’
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:44:9: note: candidate: ‘octomap::OcTreeBase<octomap::CountingOcTreeNode>::OcTreeBase(octomap::OcTreeBase<octomap::CountingOcTreeNode>&&)’
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:44:9: note:   no known conversion for argument 1 from ‘const double’ to ‘octomap::OcTreeBase<octomap::CountingOcTreeNode>&&’
[6/16] Building CXX object src/CMakeFiles/octomap.dir/AbstractOcTree.cpp.o
FAILED: src/CMakeFiles/octomap.dir/AbstractOcTree.cpp.o
/usr/bin/g++-12 -Doctomap_EXPORTS -I/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include -m64 -Wall  -Wextra -Wpedantic -O3 -funroll-loops -DNDEBUG -std=c++20 -fPIC -MD -MT src/CMakeFiles/octomap.dir/AbstractOcTree.cpp.o -MF src/CMakeFiles/octomap.dir/AbstractOcTree.cpp.o.d -o src/CMakeFiles/octomap.dir/AbstractOcTree.cpp.o -c /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/AbstractOcTree.cpp
In file included from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBaseImpl.h:83,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OccupancyOcTreeBase.h:44,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTree.h:38,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/AbstractOcTree.cpp:36:
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeIterator.hxx:42:39: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
   42 |     class iterator_base : public std::iterator<std::forward_iterator_tag, NodeType>{
      |                                       ^~~~~~~~
In file included from /usr/include/c++/12/bits/stl_construct.h:61,
                 from /usr/include/c++/12/bits/char_traits.h:46,
                 from /usr/include/c++/12/ios:40,
                 from /usr/include/c++/12/istream:38,
                 from /usr/include/c++/12/fstream:38,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/AbstractOcTree.h:38,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/AbstractOcTree.cpp:35:
/usr/include/c++/12/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
In file included from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/CountingOcTree.h:39,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/AbstractOcTree.cpp:37:
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:46:22: error: expected unqualified-id before ‘double’
   46 |     OcTreeBase<NODE>(double res) : OcTreeBaseImpl<NODE,AbstractOcTree>(res) {};
      |                      ^~~~~~
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBase.h:46:22: error: expected ‘)’ before ‘double’
   46 |     OcTreeBase<NODE>(double res) : OcTreeBaseImpl<NODE,AbstractOcTree>(res) {};
      |                     ~^~~~~~
      |                      )
[11/16] Building CXX object src/CMakeFiles/octomap.dir/OcTree.cpp.o
In file included from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeBaseImpl.h:83,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OccupancyOcTreeBase.h:44,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTree.h:38,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/src/OcTree.cpp:34:
/home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OcTreeIterator.hxx:42:39: warning: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
   42 |     class iterator_base : public std::iterator<std::forward_iterator_tag, NodeType>{
      |                                       ^~~~~~~~
In file included from /usr/include/c++/12/bits/stl_algobase.h:65,
                 from /usr/include/c++/12/list:60,
                 from /home/spaceim/.conan2/p/t/octom737ff965347f3/b/src/octomap/include/octomap/OccupancyOcTreeBase.h:38:
/usr/include/c++/12/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
ninja: build stopped: subcommand failed.

octomap/1.9.7: ERROR:
Package 'e9554f9728649ff86b11b47e22e41252ff0c68eb' build failed
Visual Studio 2022/C++20
octomap/1.9.7: Building from source
octomap/1.9.7: Package octomap/1.9.7:e650b83588a2400c6b6d90a4d87990196c53536a
octomap/1.9.7: Copying sources to build folder
octomap/1.9.7: Building your package in C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b
octomap/1.9.7: Calling generate()
octomap/1.9.7: Generators folder: C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\build\Release\generators
octomap/1.9.7: CMakeToolchain generated: conan_toolchain.cmake
octomap/1.9.7: CMakeToolchain generated: CMakePresets.json
octomap/1.9.7: CMakeToolchain generated: ..\..\..\src\CMakeUserPresets.json
octomap/1.9.7: Generating aggregated env files
octomap/1.9.7: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
octomap/1.9.7: Calling build()
octomap/1.9.7: Running CMake.configure()
octomap/1.9.7: RUN: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="C:/Users/spaceim/.conan2/p/t/octomd42ddb0f4438d/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/spaceim/.conan2/p/t/octomd42ddb0f4438d/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap"
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - vcvars_ver=14.3
[vcvarsall.bat] Environment initialized for: 'x64'
-- Using Conan toolchain: C:/Users/spaceim/.conan2/p/t/octomd42ddb0f4438d/b/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: C++ Standard 20 with extensions OFF
-- Conan toolchain: Setting BUILD_SHARED_LIBS = ON
-- The C compiler identification is MSVC 19.35.32217.1
-- The CXX compiler identification is MSVC 19.35.32217.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done


-- octomap building as Release
-- Found Doxygen: D:/Programmes/mingw64/bin/doxygen.exe (found version "1.9.5") found components: doxygen missing components: dot


-- Compile octomap using: make
-- Install octomap using: make install
--     (be sure to set the correct CMAKE_INSTALL_PREFIX before)
-- Compile API-documentation using: make docs

-- Configuring done (1.6s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/spaceim/.conan2/p/t/octomd42ddb0f4438d/b/build/Release

octomap/1.9.7: Running CMake.build()
octomap/1.9.7: RUN: cmake --build "C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\build\Release" -- -j8
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - vcvars_ver=14.3
[vcvarsall.bat] Environment initialized for: 'x64'
[1/14] Building CXX object src\CMakeFiles\octomap.dir\Pointcloud.cpp.obj
FAILED: src/CMakeFiles/octomap.dir/Pointcloud.cpp.obj
C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1435~1.322\bin\Hostx64\x64\cl.exe  /nologo /TP -Doctomap_EXPORTS -IC:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /O2 /Ob2 /DNDEBUG -std:c++20 -MD /showIncludes /Fosrc\CMakeFiles\octomap.dir\Pointcloud.cpp.obj /Fdsrc\CMakeFiles\octomap.dir\ /FS -c C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\src\Pointcloud.cpp
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\src\Pointcloud.cpp(221): error C2039: 'random_shuffle': is not a member of 'std'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\iostream(19): note: see declaration of 'std'
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\src\Pointcloud.cpp(221): error C3861: 'random_shuffle': identifier not found
[5/14] Building CXX object src\CMakeFiles\octomap.dir\AbstractOccupancyOcTree.cpp.obj
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
[7/14] Building CXX object src\CMakeFiles\octomap.dir\CountingOcTree.cpp.obj
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/OcTreeIterator.hxx(42): warning C4996: 'std::iterator<std::forward_iterator_tag,octomap::CountingOcTreeNode,ptrdiff_t,octomap::CountingOcTreeNode *,octomap::CountingOcTreeNode &>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> 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 suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xutility(6802): note: see declaration of 'std::iterator'
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/OcTreeIterator.hxx(263): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOcTree>::iterator_base' being compiled
        with
        [
            NODE=octomap::CountingOcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap\OcTreeBaseImpl.h(564): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOcTree>::leaf_iterator' being compiled
        with
        [
            NODE=octomap::CountingOcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap\OcTreeBase.h(44): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOcTree>' being compiled
        with
        [
            NODE=octomap::CountingOcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/CountingOcTree.h(76): note: see reference to class template instantiation 'octomap::OcTreeBase<octomap::CountingOcTreeNode>' being compiled
[8/14] Building CXX object src\CMakeFiles\octomap.dir\AbstractOcTree.cpp.obj
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/OcTreeIterator.hxx(42): warning C4996: 'std::iterator<std::forward_iterator_tag,octomap::OcTreeNode,ptrdiff_t,octomap::OcTreeNode *,octomap::OcTreeNode &>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> 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 suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xutility(6802): note: see declaration of 'std::iterator'
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/OcTreeIterator.hxx(263): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOccupancyOcTree>::iterator_base' being compiled
        with
        [
            NODE=octomap::OcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap\OcTreeBaseImpl.h(564): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOccupancyOcTree>::leaf_iterator' being compiled
        with
        [
            NODE=octomap::OcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap\OccupancyOcTreeBase.h(69): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOccupancyOcTree>' being compiled
        with
        [
            NODE=octomap::OcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/OcTree.h(49): note: see reference to class template instantiation 'octomap::OccupancyOcTreeBase<octomap::OcTreeNode>' being compiled
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/OcTreeIterator.hxx(42): warning C4996: 'std::iterator<std::forward_iterator_tag,octomap::CountingOcTreeNode,ptrdiff_t,octomap::CountingOcTreeNode *,octomap::CountingOcTreeNode &>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> 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 suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\xutility(6802): note: see declaration of 'std::iterator'
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/OcTreeIterator.hxx(263): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOcTree>::iterator_base' being compiled
        with
        [
            NODE=octomap::CountingOcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap\OcTreeBaseImpl.h(564): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOcTree>::leaf_iterator' being compiled
        with
        [
            NODE=octomap::CountingOcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap\OcTreeBase.h(44): note: see reference to class template instantiation 'octomap::OcTreeBaseImpl<NODE,octomap::AbstractOcTree>' being compiled
        with
        [
            NODE=octomap::CountingOcTreeNode
        ]
C:\Users\spaceim\.conan2\p\t\octomd42ddb0f4438d\b\src\octomap\include\octomap/CountingOcTree.h(76): note: see reference to class template instantiation 'octomap::OcTreeBase<octomap::CountingOcTreeNode>' being compiled
ninja: build stopped: subcommand failed.

octomap/1.9.7: ERROR:
Package 'e650b83588a2400c6b6d90a4d87990196c53536a' build failed

This PR fixes most obvious illformed syntax or logic:

  • fix definition of OcTreeBase(double res) constructor (it fixes gcc12/C++20 compilation errors)
  • more robust detection of C++11 for Visual Studio (it fixes Visual Studio2022/C++17 compilation errors)
  • remove several illegal semicolon (unlikely the reason of compilation errors, but it's neater to fix that)

- remove several illegal semicolon
- more robust detection of C++11 for Visual Studio
@ahornung
Copy link
Member

Thanks for your contribution! I think there are some general issues with the ROS CI setup, looks fine to merge.

@ahornung ahornung merged commit 8178b4f into OctoMap:devel May 23, 2023
@SpaceIm SpaceIm deleted the cpp17-compat branch May 24, 2023 12:07
@eladm-ultrawis
Copy link
Contributor

@ahornung is there a chance to submit a patch to the vcpkg port? the current version fails to build on latest MSVC.

@ahornung
Copy link
Member

@eladm-ultrawis: sure, is there something I can accept as a PR here that needs to be changed?

Not sure what you exactly mean, because I'm not maintaining the vcpkg port.

@eladm-ultrawis
Copy link
Contributor

@ahornung I see, I thought you are the maintainer. I have no idea who maintains it then.

c-andy-martin pushed a commit to BadgerTechnologies/octomap that referenced this pull request May 31, 2024
- fix definition of OcTreeBase(double res) constructor (it fixes gcc12/C++20 compilation errors)
- more robust detection of C++11 for Visual Studio (it fixes Visual Studio2022/C++17 compilation errors)
- remove several illegal semicolon (unlikely the reason of compilation errors, but it's neater to fix that)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants