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

1

6

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.

Traumatize answered 22/5, 2022 at 21:43 Comment(2)
-lbacktrace maybe?Transact
Related: #70765785Southsoutheast
S
12

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.

Spada answered 23/5, 2022 at 3:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.