天天看点

boost消除警告 #pragma message: The practice of declaring the Bind placeholders (_1, _2, ...)

boost消除警告 #pragma message: The practice of declaring the Bind placeholders (_1, _2, …)

g++ -o service main.cpp -L -lboost_thread -lboost_system -lpthread

改為:

g++ -o service main.cpp -L -lboost_thread -lboost_system -lpthread -DBOOST_BIND_GLOBAL_PLACEHOLDERS

[email protected]:~/Documents/source/boostPort$ g++ -o service main.cpp -L -lboost_thread -lboost_system -lpthread
In file included from /usr/local/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/local/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/local/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/local/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/local/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/local/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/local/include/boost/shared_ptr.hpp:17,
                 from /usr/local/include/boost/date_time/time_clock.hpp:17,
                 from /usr/local/include/boost/date_time/posix_time/posix_time_types.hpp:10,
                 from /usr/local/include/boost/asio/time_traits.hpp:23,
                 from /usr/local/include/boost/asio/detail/timer_queue_ptime.hpp:22,
                 from /usr/local/include/boost/asio/detail/deadline_timer_service.hpp:29,
                 from /usr/local/include/boost/asio/basic_deadline_timer.hpp:25,
                 from /usr/local/include/boost/asio.hpp:25,
                 from main.cpp:174:
/usr/local/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
[email protected]:~/Documents/source/boostPort$ g++ -o service main.cpp -L -lboost_thread -lboost_system -lpthread -DBOOST_BIND_GLOBAL_PLACEHOLDERS

           

继续阅读