简体   繁体   中英

VS2017 15.7.3 C++ Document Format reorders lines and causes compile errors

After I upgrade my VS2017 to the latest version (15.7.3), Document Format for C++ (Ctrl+K,Ctrl+D) will reorder all included file lines, and it also reformat other code to cause many compiling errors. Right now I have to use a diff tool to double-check code and reverse unwanted changes.

Does anyone have any ideas?

OK, after searching around the net, it looks like recent vs2017 added ClangFormat support. The default settings messed up my code. Here is vs2017 blog:

https://blogs.msdn.microsoft.com/vcblog/2018/03/13/clangformat-support-in-visual-studio-2017-15-7-preview-1/

Skimming through the ClangFormat document: https://clang.llvm.org/docs/ClangFormat.html , the code style and formatting features can be customized. Since I'm new to this, I have turned it off for the time being (Tools/Options -> TextEditor->C/C++->Formatting->General->Enable ClangFormat support).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM