Skip to content

Add missing xchar.h header for fmt > 11.0.2 (v2)#3277

Closed
ahoarau wants to merge 1 commit intogabime:v1.xfrom
ahoarau:patch-1
Closed

Add missing xchar.h header for fmt > 11.0.2 (v2)#3277
ahoarau wants to merge 1 commit intogabime:v1.xfrom
ahoarau:patch-1

Conversation

@ahoarau
Copy link
Copy Markdown

@ahoarau ahoarau commented Nov 30, 2024

Better version than #3274
Fixes #3202

NOTE: I cannot conditionally add the header based on the FMT version, as it's stuck to #define FMT_VERSION 110002, even though we're passed that version.

Tested fine on Ubuntu + clang & gcc, on both release and debug.

In fmt > 11.0.2, basic_format_string has moved from base.h to xchar.h
@gabime
Copy link
Copy Markdown
Owner

gabime commented Nov 30, 2024

fmt/xchar.h is expensive to include if wchar is not required. Why can't you include it in your code?

@tt4g
Copy link
Copy Markdown
Contributor

tt4g commented Dec 26, 2024

#3301 fixes the problem without including xchar.h.

@ahoarau ahoarau closed this Dec 26, 2024
yachoor referenced this pull request Jan 8, 2025
Include fmtlib's `xchar` header to include `fmt::basic_format_string`.
Otherwise, compilation with an external fmtlib 11.1.1 fails with

```
In file included from include/spdlog/spdlog.h:12:
include/spdlog/common.h:369:49: error: no template named 'basic_format_string' in namespace 'fmt'; did you mean 'std::basic_format_string'?
  369 | inline fmt::basic_string_view<T> to_string_view(fmt::basic_format_string<T, Args...> fmt) {
      |                                                 ^~~~~
```

Signed-off-by: Christian Blichmann <[email protected]>
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

Successfully merging this pull request may close these issues.

In fmt master, basic_format_string has moved from base.h to xchar.h

3 participants