Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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.

like image 523
user2698 Avatar asked Feb 23 '10 23:02

user2698


People also ask

How can I create my own header file in C?

To make a header file, we have to create one file with a name, and extension should be (*. h). In that function there will be no main() function. In that file, we can put some variables, some functions etc.

Is there any possibility to create a customized header file with C programming language?

So the question arises, is it possible to create your own header file? The answer to the above is yes. header files are simply files in which you can declare your own functions that you can use in your main program or these can be used while writing large C programs.

What is header file and source file in C?

A header file is a file with extension . h which contains C function declarations and macro definitions to be shared between several source files. There are two types of header files: the files that the programmer writes and the files that comes with your compiler.

Are h files generated?

h files are copied into automatically generated .


1 Answers

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

like image 137
Ryu Avatar answered Oct 13 '22 14:10

Ryu