How to customize eclipse CDT code templates

前端 未结 2 1602
执念已碎
执念已碎 2021-01-18 07:55

I need the code I am writing for a project to match some style guidelines. However the standard templates included with CDT don\'t match this style. Especially the layout of

2条回答
  •  抹茶落季
    2021-01-18 08:30

    So in the Preferences dialog under C/C++ -> Code Style -> Code Templates you can modify the template to be closer to what you need, for example if you need the namespace in the guard, you can do something like.

    ${filecomment}
    
    #ifndef ${namespace_name}_${include_guard_symbol}
    #define ${namespace_name}_${include_guard_symbol}
    
    ${includes}
    
    ${namespace_begin}
    
    ${declarations}
    
    ${namespace_end}
    
    #endif /* ${namespace_name}_${include_guard_symbol} */
    

提交回复
热议问题