Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct std::iterator’ is deprecated in segbits_file_reader.h:38 #2127

Open
buggbear opened this issue Mar 20, 2023 · 3 comments
Open

struct std::iterator’ is deprecated in segbits_file_reader.h:38 #2127

buggbear opened this issue Mar 20, 2023 · 3 comments

Comments

@buggbear
Copy link

When compiling with cmake 3.25.1 I get this error:

/home/xyz/prjxray/lib/include/prjxray/segbits_file_reader.h:38:27: error: ‘template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Werror=deprecated-declarations]
38 | : public std::iterator<std::input_iterator_tag, value_type> {
| ^~~~~~~~
In file included from /usr/include/c++/12/bits/stl_algobase.h:65,
from /usr/include/c++/12/memory:63,
from /home/xyz/prjxray/lib/include/prjxray/database.h:13:
/usr/include/c++/12/bits/stl_iterator_base_types.h:127:34: note: declared here
127 | struct _GLIBCXX17_DEPRECATED iterator
| ^~~~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [lib/CMakeFiles/libprjxray.dir/build.make:76: lib/CMakeFiles/libprjxray.dir/database.cc.o] Error 1

@ad-astra-et-ultra
Copy link
Contributor

ad-astra-et-ultra commented Mar 25, 2023

This error message indicates that the code is using the std::iterator class, which has been marked as deprecated in the C++17 standard.

The deprecated warning is being treated as an error, which is causing the compilation to fail. A quick fix would be to remove the -Werror flag from add_compile_options(-Wall -Werror) in "prjxray/CMakeLists.txt'. The deprecated warning will no longer be treated as an error, and the compilation will not fail. Instead, the warning will be displayed as a message during compilation, and the build process will continue.

For a better long-term solution, the code needs to updated to use replacements for deprecated features.

@ad-astra-et-ultra
Copy link
Contributor

ad-astra-et-ultra commented Mar 27, 2023

#2135

PR for this issue.

@aceOrange
Copy link

Met the same issue still, but was able to work around it by fixing the c++ version to 14, in the Cmakelists.txt file, by adding

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants