Way to Format C++ Code with .clang-format
in A WinUI 3 Project
#4941
Unanswered
InfyniteHeap
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question Descriptions:
Recently I am learning writing a C++ WinUI 3 program. When I use

.clang-format
to format my C++ code, the project was failed to be built and compiler ejected lots of errors like these (this screenshot shows errors when I try building project after formattingMainWindow.xaml.cpp
):Besides this, if you are using a non-VS build-in code style to format C++ code, the build will also fail.
So, how can I format my project via
.clang-format
? Or must I only use Visual Studio's code style to format C++ code?How to Reproduce:
.clang-format
file in the root directory of the project, and write these contents into it:MainWindow.xaml.cpp
, useCtrl+K
andCtrl+D
to format code.Beta Was this translation helpful? Give feedback.
All reactions