How can I generate a C++23 stacktrace with GCC 12.1?

Viewed 249

In the release notes for GCC12, under the section "Runtime Library (libstdc++)", it says:

Improved experimental C++23 support, including: [...] <stacktrace> (not built by default, requires linking to an extra library).

What library do I need to link against to use <stacktrace>? I'm on an x86 Linux system, if that matters.

1 Answers

You need to link with -lstdc++_libbacktrace (as now documented here).

In order for this to work, gcc needs to have been configured with --enable-libstdcxx-backtrace.

Related