Note when building CGAL code: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated
Asked Answered
C

1

6

When I build the CGAL examples with cmake, I get this 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.

I tried to add #define BOOST_BIND_NO_PLACEHOLDERS at the very beginning of the code and using namespace BOOST_BIND_GLOBAL_PLACEHOLDERS in the main, but it doesn't work. The code can be built, just a very annoying note.

BOOST VERSION = 1.73 GCC VERSION = 7.5.0

Crandale answered 25/7, 2020 at 5:24 Comment(4)
You should open an issue with more details including boost version, compiler version, ...Nourishment
Could you add more details? what example does produce this warning message? The testsuite contains this version of boost and no warning shows up. What compilation options are you using? any specific macro defined?Nourishment
https://mcmap.net/q/618562/-why-boost-bind-insists-pulling-boost-placeholders-into-global-namespaceAzaleeazan
I try to add ``` #define BOOST_BIND_NO_PLACEHOLDERS ``` before the problematic include line and it solved the warning for me. Thanks ;-) Please make sure that you include this before all problematic include lines. (Tried with Boost 1.74)Capreolate
P
2

For the convenience of old projects, add the following line into CMakeLists.txt to define BOOST_BIND_GLOBAL_PLACEHOLDERS in the whole project.

add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
Padriac answered 5/12, 2021 at 13:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.