introlab / find-object

Find-Object project
http://introlab.github.io/find-object/
BSD 3-Clause "New" or "Revised" License
448 stars 189 forks source link

Use C++17 if available, and boost::placeholders::_1/_2/_3 instead of deprecated _1/_2/_3 #120

Closed lucasw closed 2 years ago

lucasw commented 2 years ago

These changes are needed to build on Ubuntu 22.04.

c++17 fixes this:

In file included from /usr/include/log4cxx/log4cxx.h:45,
                 from /usr/include/log4cxx/logstring.h:28,
                 from /usr/include/log4cxx/level.h:22,
                 from /home/lucasw/catkin_ws/src/ros/rosconsole/include/ros/console.h:46,
                 from /home/lucasw/catkin_ws/src/ros/ros_comm/clients/roscpp/include/ros/ros.h:40,
                 from /home/lucasw/catkin_ws/src/roso/find-object/src/ros/FindObjectROS.h:31,
                 from /home/lucasw/catkin_ws/src/roso/find-object/src/ros/FindObjectROS.cpp:28:
/usr/include/log4cxx/boost-std-configuration.h:10:18: error: ‘shared_mutex’ in namespace ‘std’ does not name a type
   10 |     typedef std::shared_mutex shared_mutex;
      |                  ^~~~~~~~~~~~
/usr/include/log4cxx/boost-std-configuration.h:10:13: note: ‘std::shared_mutex’ is only available from C++17 onwards
   10 |     typedef std::shared_mutex shared_mutex;
      |             ^~~
/usr/include/log4cxx/boost-std-configuration.h:12:30: error: ‘shared_lock’ in namespace ‘std’ does not name a template type
   12 |     using shared_lock = std::shared_lock<T>;
      |                              ^~~~~~~~~~~
/usr/include/log4cxx/boost-std-configuration.h:12:25: note: ‘std::shared_lock’ is only available from C++14 onwards
   12 |     using shared_lock = std::shared_lock<T>;

And boost placeholders fixes this:

/home/lucasw/catkin_ws/src/roso/find-object/src/ros/CameraROS.cpp:77:115: error: ‘_2’ was not declared in this scope
   77 |                         approxSync_->registerCallback(boost::bind(&CameraROS::imgDepthReceivedCallback, this, _1, _2, _3));
matlabbe commented 2 years ago

Thx!