简体   繁体   English

VS2017 15.7.3 C ++文档格式对行进行重新排序并导致编译错误

[英]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. 将VS2017升级到最新版本(15.7.3)后,C ++的文档格式(Ctrl + K,Ctrl + D)将重新排列所有包含的文件行,并且还会重新格式化其他代码,从而导致许多编译错误。 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. 好的,在网上搜索之后,看起来好像最近对vs2017添加了ClangFormat支持。 The default settings messed up my code. 默认设置弄乱了我的代码。 Here is vs2017 blog: 这是vs2017博客:

https://blogs.msdn.microsoft.com/vcblog/2018/03/13/clangformat-support-in-visual-studio-2017-15-7-preview-1/ 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. 浏览ClangFormat文档: https ://clang.llvm.org/docs/ClangFormat.html,可以自定义代码样式和格式设置功能。 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). 由于我是新手,因此暂时将其关闭(“工具/选项-> TextEditor-> C / C ++->格式化->常规->启用ClangFormat支持”)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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