简体   繁体   English

C++ 源代码文本编辑器,支持.h.cpp 同步

[英]C++ source code text editor with .h .cpp sync support

Is there a (free) text editor that automatically synchronizes method declarations so that if I update method definition in a.CPP then its declaration in the.H gets updated automatically (and vice versa)?是否有一个(免费)文本编辑器可以自动同步方法声明,以便如果我更新 a.CPP 中的方法定义,那么它在.H 中的声明会自动更新(反之亦然)?

Better yet, present the class' source code in a single editor view and generate.H and.CPP from it automatically.更好的是,在单个编辑器视图中显示类的源代码并自动从中生成.H 和.CPP。

MS Visual Studio has some support for that, but its not free. MS Visual Studio 对此有一些支持,但它不是免费的。

If you're editing a stable library then you do not want this , because you really care about when you change an interface -- since it probably means you're breaking compatibility with something else.如果您正在编辑一个稳定的库,那么您不想要这个,因为您真的很关心何时更改界面——因为这可能意味着您正在破坏与其他东西的兼容性。

If you're in the rapid-prototyping stage, then why not put all your definitions in the header file, and worry about separating them into the implementation file later.如果您处于快速原型设计阶段,那么为什么不将所有定义都放在 header 文件中,然后再担心将它们分离到实现文件中。

That said, I know of nothing that actually does what you want, so:就是说,我不知道实际上可以满足您的要求,因此:

If you want to implement this, I'd suggest writing a third header&implementation file (that the compiler never sees), which you actually edit, and then adding a pre-compilation stage that automatically splits it into header and source.如果你想实现这个,我建议编写第三个头文件和实现文件(编译器永远不会看到),你实际编辑它,然后添加一个预编译阶段,自动将其拆分为 header 和源代码。 You'll probably want to annotate include directives to show where they need to be.您可能想要注释包含指令以显示它们需要在哪里。

Take a look at makeheaders .看看makeheaders It does not provide parallel editing features, but instead generates headers from your source files.它不提供并行编辑功能,而是从源文件生成标题。

KDevelop has some support for it. KDevelop 对它有一些支持。 Not flawless, but it is pretty good.不是完美无缺,但它非常好。 One of my projects is cross platform, and whenever I need to expand my code, I prefer KDevelop over Visual Studio.我的一个项目是跨平台的,每当我需要扩展我的代码时,我更喜欢 KDevelop 而不是 Visual Studio。

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

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