在 IDE 中自动生成 C 源文件的头文件
我正在尝试使用 Eclipse 和 NetBeans 进行 C(而不是 C++)编程。是否有一个功能/插件可以自动保持源文件和头文件同步?
例如,当我在源文件中实现一个函数时,它是否会自动在头文件中插入正确的行?
我确实看过像lzz这样的解决方案,但它们不是我正在寻找的。
I am trying to use Eclipse and NetBeans for programming in C (not C++). Is there a feature/plugin for them which automatically keeps the source and header files in sync?
As in, when I implement a function in the source file, does it automatically insert the correct lines in the header file?
I did look at solutions like lzz, but they are not what I am looking for.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Eclipse CDT 允许您在头文件中编写原型,并自动将其添加到 C 文件中。
说明
可能是你开箱即用的最好的方法
Eclipse CDT allows you to write a prototype in the header file, and automatically add it to the C file.
Instructions
Thats probably the best you're gonna get out of the box
同意Ryu提出的方法。在 C 中,我不会自动在标头中创建声明。这应该是一个显式操作,公开 C 模块中的某些符号。
但是,如果声明/实现已经设置并且您想要修改其中任何一个,我想在 Eclipse 中您可能需要使用 切换函数定义在可能的工作流程中,您可以在剪贴板中复制中间切换结果,然后将其粘贴到更改的声明上或实施声明。
当你改变东西时,也要集中使用重命名重构。
Agree with approach proposed by Ryu. In C, I would not automatically create declarations in headers. This should be an explicit action making public some symbol from the C module.
However if declaration/implementation are already setup and you want to modify any of them, I imagine that with Eclipse you may want to use Toggle Function Definition in a possible workflow where you copy in clipboard intermediate toggling results and paste them later over the changed declaration or implementation declaration.
Also use rename refactoring intensively when you change things.