从.h文件Visual Studio创建.cpp文件 [英] Creating .cpp files from .h files visual studio

查看:291
本文介绍了从.h文件Visual Studio创建.cpp文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2008,并且想知道是否可以在给定头文件的情况下创建.cpp文件.

I am using Visual Studio 2008, and I was wondering if it was possible to create the .cpp files given the header files.

因此,如果我有一个带有类和函数的.h文件,它可以创建带有所有输入的函数并带有空白正文的代码文件

So if I have a .h files with a class and functions, it can create the code file with all the functions typed in with a blank body

推荐答案

快捷方式:alt+shift+f10(VS2015)

Shortcut: alt+shift+f10 (VS2015)

我寻找这个东西已经有十多年了,无数次被告知没有类似的东西存在,而且人们需要以某种方式使用外部工具来获得这个基本功能.

I've looked for this for over 10+ years, been told numerous times that nothing like this exists, and that one needs to somehow use external tools to get this basic functionality.

...现在,我终于找到了有用的东西.

... Now, I've finally found something useful.

突出显示.h文件中的类名,并使用该快捷方式将使intellisense生成相关定义(如果未创建,还将创建.cpp文件).

Highlight the class name in you .h file, and using that shortcut will make intellisense generate the relevant definitions (also creating the .cpp file if not created).

这也是ex.的通用快捷方式.如果您在标题中创建函数签名(并突出显示函数名称),则为您创建方法存根.从下面的屏幕快照中可以看到,它还允许您从父类等自动创建所有虚拟.

It's also a general purpose shortcut that ex. creates method stubs for you, if you create function signatures in the header (and highlight the function name). As you can see from the screenshot below, it also allows you to auto create all virtuals from the parent class, etc.

我绝对不敢相信这在多大程度上提高了生产率( 再见手动复制粘贴! ).直到这一点,我都感到非常震惊,即使在Stack Overflow中,我也从未见过/从未得到过对此的引用.

I absolutely cannot believe how much this has suddenly improved productivity (goodbye manual copy paste!). And I find it utterly shocking how I have never seen / been given reference to this, even in Stack Overflow, up until this point.

享受您的新力量,并传播这个词!

Enjoy your new powers, and spread the word!

这篇关于从.h文件Visual Studio创建.cpp文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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