stephanecharette / DarkMark

Marking up images for use with Darknet.
https://www.ccoderun.ca/darkmark/Summary.html
Other
160 stars 21 forks source link

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

Open kevung opened 1 year ago

kevung commented 1 year ago

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

stephanecharette commented 1 year ago

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

kevung commented 1 year ago

Hello Stephane, As indicated in https://github.com/stephanecharette/DarkMark/issues/26#issuecomment-1629503119 (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

stephanecharette commented 1 year ago

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 1 year ago

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.

stephanecharette commented 1 year ago

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

stephanecharette commented 11 months ago

This should be fixed by https://github.com/stephanecharette/DarkMark/commit/e7a4daea79e1cd0934ae962b2a06c7dacba3d110