开发者

Auto generate header files for a C source file in an IDE

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 automatica开发者_如何学Golly insert the correct lines in the header file?

I did look at solutions like lzz, but they are not what I am looking for.


Eclipse CDT allows you to write a prototype in the header file, and automatically add it to the C file.

Instructions

  1. Add function prototype to .h file void foobar()
  2. Select the function name "foobar" (try double clicking)
  3. In the toolbar click Source -> Implement Method
  4. Wizard it up

Thats probably the best you're gonna get out of the box


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜