本文介绍了Eclipse如何缩进C ++预处理程序宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 我在eclipse中找不到设置,因此可以像缩进代码一样自动使预处理程序宏缩进。例如eclipse尝试格式化这样的代码。I can't find a setting in eclipse so that I can have it automatically indent my preprocessor macros the same way it indents code. For example eclipse tries to format code like this.int main(){#ifdef SOMETHING cout << "Something Defined" << endl;#endif return 0;}而我希望它看起来像...Whereas I want it to look like...int main(){ #ifdef SOMETHING cout << "Something Defined" << endl; #endif return 0;}任何让日食发生的想法都会如何实现?Any ideas to make eclipse do it how I want?推荐答案 ANSI C预处理器不允许在行首与#字符之间留空格;Pre-ANSI C preprocessor did not allow for space between the start of a line and the "#" character; the leading "#" had to always be placed in the first column.如今,Pre-ANSI C编译器不存在了。使用您喜欢的样式(#前的空格或#与标识符之间的空格)。Pre-ANSI C compilers are non-existent these days. Use which ever style (space before "#" or space between "#" and the identifier) you prefer.但是我建议您这样做:But I suggest you do this:只需使用查找/替换对话框并按全部替换Just use Find/Replace dialog and the push "Replace all" 这篇关于Eclipse如何缩进C ++预处理程序宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-06 21:20