Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically generate C++ file from header?

I have a bunch of C++ header files with various class and function declarations. So far, when I've been writing the C++ source file implementations of the declared classes and functions, I've been manually:

  1. Copying the declarations from the header file to the corresponding source file.
  2. Deleting "class classname {" and the matching "};"
  3. Adding "classname::" onto the names of all the class functions.
  4. Replacing the semicolons after the function declarations with "{}".
  5. Deleting the keywords "virtual" and "static".

Only after all that work, which doesn't really do anything, can I actually go about implementing the functions. I am wondering if there is a tool out there somewhere that can automatically generate a ".cpp" file from a ".h" file, where the resulting ".cpp" contains empty stubs for the functions declared in the ".h" file (and for which an inline definition hasn't been given). A UNIX-friendly commandline tool would be preferred. Thanks.

UPDATE: A cross-platform tool would be ideal. If not, I am working on Mac OS X 10.6.

like image 358
Michael Aaron Safyan Avatar asked Sep 10 '09 10:09

Michael Aaron Safyan


1 Answers

Lazy C++ appears to be designed to address precisely that problem.

like image 73
moonshadow Avatar answered Sep 28 '22 09:09

moonshadow