stephanecharette/DarkMark

error: ‘void (* std::set_unexpected(unexpected_handler))()’ is deprecated [-Werror=deprecated-declarations]

Opened this issue · 6 comments

kevung commented

Dear Stephane,

Context:
OS= Arch Linux
GCC 13.1.1

After cloning, mkdir build, cd build, cmake .., cmake --build .,
I get the following error

unger% cmake --build . --parallel 15
[ 10%] Built target dm_launcher
[ 18%] Built target dm_darknet
[ 34%] Built target dm_juce
[ 48%] Built target dm_wnd
[ 68%] Built target dm_tools
[ 94%] Built target dm_darkmark
[ 96%] Building CXX object src-main/CMakeFiles/DarkMark.dir/DarkMarkApp.cpp.o
/home/unger/src/DarkMark/src-main/DarkMarkApp.cpp: In member function ‘virtual void dm::DarkMarkApplication::initialise(const juce::String&)’:
/home/unger/src/DarkMark/src-main/DarkMarkApp.cpp:248:28: error: ‘void (* std::set_unexpected(unexpected_handler))()’ is deprecated [-Werror=deprecated-declarations]
  248 |         std::set_unexpected(DarkMark_CPlusPlus_Unexpected_Handler);
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13.1.1/ios:41,
                 from /usr/include/c++/13.1.1/istream:40,
                 from /usr/include/c++/13.1.1/fstream:40,
                 from /home/unger/src/DarkMark/src-main/DarkMark.hpp:6,
                 from /home/unger/src/DarkMark/src-main/DarkMarkApp.cpp:3:
/usr/include/c++/13.1.1/exception:89:22: note: declared here
   89 |   unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT;
      |                      ^~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [src-main/CMakeFiles/DarkMark.dir/build.make:76: src-main/CMakeFiles/DarkMark.dir/DarkMarkApp.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:403: src-main/CMakeFiles/DarkMark.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Thank you for your work
I stay at your disposal for further information.
Take care

Kevin

Are you blocked, or do you know how to get past this error?

kevung commented

Hello Stephane,
As indicated in #26 (comment) (I posted by mistake in the wrong issue), this function has been removed in C++ 17.

I'm still currently blocked by this error. I'll try to bypass it maybe by deleting the mentionned lines in the source code.
Does DarkMark should be compiled against a specific C++ standard?
In https://github.com/stephanecharette/DarkMark/blob/master/CM_definitions.cmake, C++ 17 is chosen.

Bye
Kévin

You can remove the -Werror flag in the CMake file, or you can comment out line #248 which is causing this warning to be issued.

I'm still on an older version of GCC/G++ which is why I'm not seeing this warning.

kevung commented

Thank you very much.
I indeed could successfully compile DarkMark by desactivating -Werror in https://github.com/stephanecharette/DarkMark/blob/master/CM_source.cmake#L28

As it is not a bug, but maybe a regression, I close this ticket.
Thank you very much for your assistance.

Re-opening since this will need to be dealt with.

This should be fixed by e7a4dae