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.
You need to link with -lstdc++_libbacktrace
(as documented here). Note that since GCC14, you should use -lstdc++exp
instead (as documented here).
In order for this to work, gcc needs to have been configured with --enable-libstdcxx-backtrace
.