从头自动生成C ++文件? [英] Automatically generate C++ file from header?

查看:252
本文介绍了从头自动生成C ++文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆C ++头文件与各种类和函数声明。到目前为止,当我编写已声明的类和函数的C ++源文件实现时,我已经手动:

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

  2. 删除class classname {和匹配的};

  3. 添加classname

  4. 用{}替换函数声明后的分号。

  5. 删除关键字virtualandstatic。

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

只有在所有工作完成后,实现功能。我想知道是否有一个工具,在某处可以自动从.h文件生成一个.cpp文件,其中生成的.cpp包含在.h文件中声明的函数的空存根(并且没有给出内联定义)。一个UNIX友好的命令行工具将是首选。谢谢。

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.

更新:跨平台工具将是理想的。如果没有,我正在使用Mac OS X 10.6。

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

推荐答案

Lazy C ++ 似乎是为了解决这个问题。

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

这篇关于从头自动生成C ++文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆