C++支持 .h .cpp 同步的源代码文本编辑器
是否有一个(免费)文本编辑器可以自动同步方法声明,以便如果我更新 .CPP 中的方法定义,那么它在 .H 中的声明也会自动更新(反之亦然)?
更好的是,在单个编辑器视图中显示类的源代码并自动生成 .H 和 .CPP。
MS Visual Studio 对此有一些支持,但它不是免费的。
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)?
Better yet, present the class' source code in a single editor view and generate .H and .CPP from it automatically.
MS Visual Studio has some support for that, but its not free.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您正在编辑一个稳定的库,那么您不希望这样,因为您真正关心的是何时更改接口 - 因为这可能意味着您破坏了与其他内容的兼容性。
如果您处于快速原型阶段,那么为什么不将所有定义放在头文件中,并担心稍后将它们分离到实现文件中。
也就是说,我不知道什么能真正做到你想要的,所以:
如果你想实现这个,我建议编写第三个头文件和实现文件(编译器永远不会看到),你实际编辑它,然后添加预编译阶段,自动将其分为标头和源代码。您可能需要注释包含指令以显示它们需要位于的位置。
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.
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. You'll probably want to annotate include directives to show where they need to be.
看一下 makeheaders。它不提供并行编辑功能,而是从源文件生成标头。
Take a look at makeheaders. It does not provide parallel editing features, but instead generates headers from your source files.
KDevelop 对此有一些支持。虽然不是完美无缺,但也相当不错了。我的项目之一是跨平台的,每当我需要扩展代码时,我更喜欢 KDevelop 而不是 Visual Studio。
KDevelop has some support for it. 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.