Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Fix build error on code page 949 #81

Closed
wants to merge 1 commit into from
Closed

Fix build error on code page 949 #81

wants to merge 1 commit into from

Conversation

raeperd
Copy link

@raeperd raeperd commented Aug 5, 2020

When I built without making any changes to this project, I found the following error.

[main] Building folder: cpp_starter_project 
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/lab/cpp_starter_project/build --config Debug --target ALL_BUILD -- /maxcpucount:14
[build] Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Framework
[build] Copyright (C) Microsoft Corporation. All rights reserved.
[build] 
[build]   Checking Build System
[build]   Building Custom Rule C:/lab/cpp_starter_project/test/CMakeLists.txt
[build]   Building Custom Rule C:/lab/cpp_starter_project/src/CMakeLists.txt
[build]   catch_main.cpp
[build]   main.cpp
[build] C:\Users\PC\.conan\data\fmt\6.2.0\_\_\package\9ffec4a59d60a2ccf636e06ba57253e21417f01b\include\fmt/core.h(327,35): error C2220: the following warning is treated as an error [C:\lab\cpp_starter_project\build\src\intro.vcxproj]
[build] C:\Users\PC\.conan\data\fmt\6.2.0\_\_\package\9ffec4a59d60a2ccf636e06ba57253e21417f01b\include\fmt/core.h(327,35): warning C4566: character represented by universal-character-name '\u00B5' cannot be represented in the current code page (949) [C:\lab\cpp_starter_project\build\src\intro.vcxproj]
[build] C:\Users\PC\.conan\data\spdlog\1.5.0\_\_\package\cf72f4f3a71ff1fe5381d0f0ebe068c867c28045\include\spdlog/details/circular_q.h(1,1): warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss [C:\lab\cpp_starter_project\build\src\intro.vcxproj]
[build]   catch_main.vcxproj -> C:\lab\cpp_starter_project\build\lib\catch_main.lib
[build]   Building Custom Rule C:/lab/cpp_starter_project/test/CMakeLists.txt
[build]   Building Custom Rule C:/lab/cpp_starter_project/test/CMakeLists.txt
[build]   Building Custom Rule C:/lab/cpp_starter_project/test/CMakeLists.txt
[build]   tests.cpp
[build]   constexpr_tests.cpp
[build]   constexpr_tests.cpp
[build]   constexpr_tests.vcxproj -> C:\lab\cpp_starter_project\build\bin\constexpr_tests.exe
[build]   tests.vcxproj -> C:\lab\cpp_starter_project\build\bin\tests.exe
[build]   relaxed_constexpr_tests.vcxproj -> C:\lab\cpp_starter_project\build\bin\relaxed_constexpr_tests.exe
[build] Build finished with exit code 1

And that only needs one line fix. add compile option for utf8

Unlike what I've been doing like this reference, I found author of this repo might not want to modify compile options. For that consistency, this request should not be merged.
Still, I wonder if someone else who has the same problem as me will help.

I think following cmake configure log will be enough to explain my environment

[main] Building folder: cpp_starter_project 
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/lab/cpp_starter_project/build --config Debug --target ALL_BUILD -- /maxcpucount:14
[build] Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Framework
[build] Copyright (C) Microsoft Corporation. All rights reserved.
[build] 
[build]   Checking Build System
[build]   Building Custom Rule C:/lab/cpp_starter_project/test/CMakeLists.txt
[build]   Building Custom Rule C:/lab/cpp_starter_project/src/CMakeLists.txt
[build]   catch_main.cpp
[build]   main.cpp
[build] C:\Users\PC\.conan\data\fmt\6.2.0\_\_\package\9ffec4a59d60a2ccf636e06ba57253e21417f01b\include\fmt/core.h(327,35): error C2220: the following warning is treated as an error [C:\lab\cpp_starter_project\build\src\intro.vcxproj]
[build] C:\Users\PC\.conan\data\fmt\6.2.0\_\_\package\9ffec4a59d60a2ccf636e06ba57253e21417f01b\include\fmt/core.h(327,35): warning C4566: character represented by universal-character-name '\u00B5' cannot be represented in the current code page (949) [C:\lab\cpp_starter_project\build\src\intro.vcxproj]
[build] C:\Users\PC\.conan\data\spdlog\1.5.0\_\_\package\cf72f4f3a71ff1fe5381d0f0ebe068c867c28045\include\spdlog/details/circular_q.h(1,1): warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss [C:\lab\cpp_starter_project\build\src\intro.vcxproj]
[build]   catch_main.vcxproj -> C:\lab\cpp_starter_project\build\lib\catch_main.lib
[build]   Building Custom Rule C:/lab/cpp_starter_project/test/CMakeLists.txt
[build]   Building Custom Rule C:/lab/cpp_starter_project/test/CMakeLists.txt
[build]   Building Custom Rule C:/lab/cpp_starter_project/test/CMakeLists.txt
[build]   tests.cpp
[build]   constexpr_tests.cpp
[build]   constexpr_tests.cpp
[build]   constexpr_tests.vcxproj -> C:\lab\cpp_starter_project\build\bin\constexpr_tests.exe
[build]   tests.vcxproj -> C:\lab\cpp_starter_project\build\bin\tests.exe
[build]   relaxed_constexpr_tests.vcxproj -> C:\lab\cpp_starter_project\build\bin\relaxed_constexpr_tests.exe
[build] Build finished with exit code 1

@ddalcino
Copy link
Collaborator

ddalcino commented Aug 5, 2020

It looks like the fmt developers fixed this bug (see: fmtlib/fmt#1625) when they released version 7.0.0. If you look at their current source, they added a warning suppression, since they have determined that it’s a false positive: https://github.com/fmtlib/fmt/blob/61602a75db980737870e7f5e91de99e49dcd1c9e/include/fmt/core.h#L320

I may be wrong, but I think it makes more sense for this project to pull in a newer version of fmt rather than tell all of our MSVC users that they have to use UTF8.

Edit: Additionally, if you still want to add that compile option, you’ll need to put it behind a conditional that checks which compiler you’re using. Clang and gcc both report errors when given that option, or, at least they did on Travis CI.

@raeperd
Copy link
Author

raeperd commented Aug 6, 2020

Thanks @ddalcino, for your kind explanation. I didn't check out fmt library for that update.
As u described, it is absolutely better to pull newer version of fmt library.
Because that would be different type of work from this pull request, I'm closing this request first, and work on another branch for that later.

While I'm working on this travis bug, found another bugs for this. So i will report this later on. Thanks.

@raeperd raeperd closed this Aug 6, 2020
ddalcino added a commit to ddalcino/cpp_starter_project that referenced this pull request Oct 8, 2020
The `fmt` update is meant to address a bug reported in cpp-best-practices#81.

Note that `spdlog/1.8.0` is dependent on `fmt/7.0.3`.

Related to cpp-best-practices#64: specific dependency versions supersede cpp-best-practices#64, but this
does not supplant the move to a separate file. Unless these
dependencies are moved to a separate file, the process of bumping these
dependencies cannot be easily automated. PRs like this one will be
necessary to keep packages up to date.
ddalcino added a commit to ddalcino/cpp_starter_project that referenced this pull request Oct 8, 2020
The `fmt` update is meant to address a bug reported in cpp-best-practices#81.

Note that `spdlog/1.8.0` is dependent on `fmt/7.0.3`.

Related to cpp-best-practices#65: specific dependency versions supersede cpp-best-practices#65, but this
does not supplant the move to a separate file. Unless these
dependencies are moved to a separate file, the process of bumping these
dependencies cannot be easily automated. PRs like this one will be
necessary to keep packages up to date.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants