Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual Studio 2010 C++;代码格式化程序 我在VisualStudio中编写C++程序是新的。当我在VS中编写C#程序时,代码格式化程序会更改如下代码 for(int i= 0; i<(n+ m) ; i++){ } for(int i=0;i_C++_Visual Studio 2010_Code Formatting - Fatal编程技术网

Visual Studio 2010 C++;代码格式化程序 我在VisualStudio中编写C++程序是新的。当我在VS中编写C#程序时,代码格式化程序会更改如下代码 for(int i= 0; i<(n+ m) ; i++){ } for(int i=0;i

Visual Studio 2010 C++;代码格式化程序 我在VisualStudio中编写C++程序是新的。当我在VS中编写C#程序时,代码格式化程序会更改如下代码 for(int i= 0; i<(n+ m) ; i++){ } for(int i=0;i,c++,visual-studio-2010,code-formatting,C++,Visual Studio 2010,Code Formatting,如果你有现金可以花,你可能想看看。另请参见,问题。Visual Studio无法格式化C++代码。可能有VS扩展。我搜索了很长时间,但从未免费找到合适的扩展 一个非常好的、免费但不易使用的代码格式化程序是。它是一个命令行工具 您可以将其配置为“外部工具”: 在您的硬盘上解压GreatCode后,只需进入工具->外部工具->添加并插入以下设置 无论何时调用该工具,都会格式化实际打开的文件 你可以在gc.cfg中随心所欲地配置GreatCode。我尝试了许多选项,有些简单,有些复杂 如果您想要类似

如果你有现金可以花,你可能想看看。另请参见,问题。

Visual Studio无法格式化C++代码。可能有VS扩展。我搜索了很长时间,但从未免费找到合适的扩展

一个非常好的、免费但不易使用的代码格式化程序是。它是一个命令行工具

您可以将其配置为“外部工具”:

在您的硬盘上解压GreatCode后,只需进入工具->外部工具->添加并插入以下设置

无论何时调用该工具,都会格式化实际打开的文件

你可以在gc.cfg中随心所欲地配置GreatCode。我尝试了许多选项,有些简单,有些复杂

如果您想要类似Microsoft的外观,只需使用“我的设置”作为模板,并对自己进行微调:

-code_constructor_style-1
-code_split_fctdef_style-5
-code_split_decl_style-2
-overwrite_read_only-
-verbose-
-tab_out-
-space_if-
-space_return-
-space_fctcall_inparam-
-no-space_fctcall_firstparam-
-no-space_cast_after-
-space_affect_style-0
-space_autoaffect_style-0
-code_len-180
-code_keep_more_empty_lines-
-code_decl_access_to_type-
-code_decl_break_template-
-code_remove_return_paren-
-code_align_max_blanks-80
-code_class_access_eol_after-1
-code_class_access_eol_before-1
-code_split_fctcall_style-1
-code_constructor_style-1
-no-code_split_bool_before-
-no-stmt_concat_else_if-
-no-stmt_decl_remove_empty-
-no-stmt_concat_if_remove_empty-
-no-stmt_concat_else_if-
-stmt_force_brace-1
-stmt_break_dowhile-
-stmt_switch_style-1
-stmt_switch_eol-0
-stmt_class_indent-0
-stmt_static_init_style-2
-stmt_concat_inline_class-
-pp_align_to_code-
-pp_style-1
-pp_align_breakline-
-no-cmt_first_space_cpp-
-cmt_dont_modify-
-no-cmt_add_class_access-
-no-cmt_add_gc_tag-
-no-cmt_add_fct_def_class-
-no-cmt_decl_before-
-no-cmt_decl-
-no-cmt_first_line_break_first-
-no-cmt_first_line_break_last-
-no-code_split_bool_before-
-catch_eol_before-1
-no-stmt_decl_remove_empty-
-no-cmt_add_fct_def_class-
-no-cmt_add_class_access-
-no-stmt_break_alone-
-stmt_concat_inline_class-
-cmt_keep_cpp-

祝你好运!

除了格式化工具本身,我使用的方法与Dirkmusf完全相同。我建议你使用艺术风格格式化工具:


它有很好的文档,并且有很多预定义的格式化样式,所以它非常容易使用。

< P>很久以来,我在NETBeBeS中编写所有C++代码,我在VisualStudio中编译它。NETBeas完美地格式化代码(用ALT+Shift +F)还有许多格式选项。

根据您的配置,相同的功能可能只是一个不同的和弦。我记得它是(Ctrl-a)Ctrl-K Ctrl-F(或Ctrl-Shift-F…我不确定)Ctrl—A,然后CTRL—K,CTRL—F确实做了一个“自动套用格式”。然而,C++中的自动套用格式只会正确地编码代码,但不会做任何高级的操作,例如间距或确保括号被正确缩进。它只会整理出标签缩进级别。为什么不复制并粘贴<代码> CFG < /代码>文件到您的答案中?这会使您满意。r answer更有用。感谢您提供answer和.cfg文件。VS2010和VS2012有一个扩展名,它将Artic Styler与IDE集成在一起。名为AStyle;您可以通过“工具”菜单上的“扩展名”项或从这里获得它:给未来用户的说明:1.您需要为AStyle的格式文档指定一个键盘快捷键;2.阅读在你改变任何东西之前的ir文档。顺便说一句,我是Java brace options的粉丝。它在CSS和C中被称为半扩展。我搜索了很多方法,尝试了很多方法,包括GC.exe。但是这个AStyle真的很好。请查看它的文档,非常详细。每个选项的“was”和“is”都可以清楚地看到。谢谢分享这似乎做了很多好事,但格式化代码并不是它宣传的功能之一。。。
-code_constructor_style-1
-code_split_fctdef_style-5
-code_split_decl_style-2
-overwrite_read_only-
-verbose-
-tab_out-
-space_if-
-space_return-
-space_fctcall_inparam-
-no-space_fctcall_firstparam-
-no-space_cast_after-
-space_affect_style-0
-space_autoaffect_style-0
-code_len-180
-code_keep_more_empty_lines-
-code_decl_access_to_type-
-code_decl_break_template-
-code_remove_return_paren-
-code_align_max_blanks-80
-code_class_access_eol_after-1
-code_class_access_eol_before-1
-code_split_fctcall_style-1
-code_constructor_style-1
-no-code_split_bool_before-
-no-stmt_concat_else_if-
-no-stmt_decl_remove_empty-
-no-stmt_concat_if_remove_empty-
-no-stmt_concat_else_if-
-stmt_force_brace-1
-stmt_break_dowhile-
-stmt_switch_style-1
-stmt_switch_eol-0
-stmt_class_indent-0
-stmt_static_init_style-2
-stmt_concat_inline_class-
-pp_align_to_code-
-pp_style-1
-pp_align_breakline-
-no-cmt_first_space_cpp-
-cmt_dont_modify-
-no-cmt_add_class_access-
-no-cmt_add_gc_tag-
-no-cmt_add_fct_def_class-
-no-cmt_decl_before-
-no-cmt_decl-
-no-cmt_first_line_break_first-
-no-cmt_first_line_break_last-
-no-code_split_bool_before-
-catch_eol_before-1
-no-stmt_decl_remove_empty-
-no-cmt_add_fct_def_class-
-no-cmt_add_class_access-
-no-stmt_break_alone-
-stmt_concat_inline_class-
-cmt_keep_cpp-