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

'Unicode support requires compiling with /utf-8' compiling with msvc #42965

Open
Karma5s opened this issue Dec 27, 2024 · 5 comments
Open

'Unicode support requires compiling with /utf-8' compiling with msvc #42965

Karma5s opened this issue Dec 27, 2024 · 5 comments
Assignees
Labels
requires:repro The issue is not currently repro-able Stale

Comments

@Karma5s
Copy link

Karma5s commented Dec 27, 2024

vcpkg_installed\x64-windows\x64-windows\include\fmt\base.h(458,28): error C2338: static_assert failed: 'Unicode support requires compiling with /utf-8'
when compiling with MSVC following this tutorial
https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-msbuild?pivots=shell-powershell

Originally posted by @Karma5s in #40944 (comment)

@JonLiu1993 JonLiu1993 added the requires:repro The issue is not currently repro-able label Dec 30, 2024
@JonLiu1993
Copy link
Member

@Karma5s, could you provide detailed steps to reproduce? I can successfully build fmt with MSVC following this tutorial
https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-msbuild?pivots=shell-powershell

Image

@JackBoosY
Copy link
Contributor

Please provide fmt configure logs and build logs.

@RainesArt
Copy link

You can try Adding Command Line /utf-8 seems to work.

Copy link

github-actions bot commented Feb 3, 2025

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

@github-actions github-actions bot added the Stale label Feb 3, 2025
@patrikhuber
Copy link
Contributor

This error occurs if you include spdlog, or a dependency / dependent header that uses spdlog, and don't use target_link_libraries(my-app PRIVATE spdlog::spdlog). What probably happens is that CMake target contains the utf-8 flag (passed down from spdlog or fmt), so naturally, if you don't link against that target in CMake, your code will compile without the utf-8 flag, which then leads to the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires:repro The issue is not currently repro-able Stale
Projects
None yet
Development

No branches or pull requests

5 participants