I just restarted working on a project which has been on hold for a few months. Last time I compiled it it was working just fine, without any error nor warning. Yet when I tried to compile it earlier today I got this warning
attention : ‘template<class _Operation> class std::binder2nd’ is deprecated [-Wdeprecated-declarations]
This warning literally appears hundreds of time when including Eigen/Geometry, which I use all over my project
In file included from [...]/include/Eigen/src/Core/ArrayBase.h:109:0,
from [...]/include/Eigen/Core:350,
from [...]/include/Eigen/Geometry:4,
from [...]/include/[myproject]/types.hh:8,
from [...]/include/[myproject]/voronoi.hh:8
Since then I haven't updated Eigen (is used 3.2.4 which is still the last update today). However, since last time I compiled it, GCC has been updated to 5.1.0 (I'm using archlinux)
Question:
I appreas that std::bind2nd
is really deprecated and that a commit has been done to solve that in Eigen. This commit is however not yet merged with the master branch :/ (and doesn't solve the issue as some std::bind2nd
are still present in Eigen's code)
Bottom line is: Eigen's last stable version is deprecated
Manfred Eigen, (born May 9, 1927, Bochum, Germany—died February 6, 2019), German physicist who was corecipient, with Ronald George Wreyford Norrish and George Porter, of the 1967 Nobel Prize for Chemistry for work on extremely rapid chemical reactions.
The Eigen/Dense header file defines all member functions for the MatrixXd type and related types (see also the table of header files). All classes and functions defined in this header file (and other Eigen header files) are in the Eigen namespace.
Install Eigen3 (Windows)Download the desired release from http://eigen.tuxfamily.org. Unzip in the location of your choice, preferrably at C:\ or C:\Program files for better discoverability by CMake find-modules (remember to extract the inner folder and rename it to Eigen3 or Eigen ).
No, the C++ standard says it's deprecated in C++11, so if you compile in C++11 mode then it is supposed to be deprecated.
Yes. if it wants to be C++17 compatible, as std::bind2nd
doesn't exist post-C++14 at all.
Suppress the warning. Either compile with -Wno-deprecated-declarations
on the command-line or do it in the source when including the Eigen headers:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <eigen/whatever.h>
#pragma GCC diagnostic pop
Or, as the other answer says, tell GCC to treat the Eigen headers as system headers, which happens automatically if they are in /usr/include
, or are included with -isystem
, or are included from another header that does:
#pragma GCC system_header
#include <eigen/whatever.h>
How can I silent those specific warning without loosing the verbosity ?
Edit the CMakeLists.txt file. Add this line somewhere after CMAKE_CXX_FLAGS is set.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
Previous answer mentioned adding this to #pragma or to command line. I am biased against #pragma because I find it hard later on to remember where I put it. So as general practice, I try to avoid #pragma. Adding to command line means you have to remember to type this everytime you recompile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With