你如何在 VS 2017 中默认 .hpp 扩展名 [英] How do you make .hpp extension default in VS 2017

查看:54
本文介绍了你如何在 VS 2017 中默认 .hpp 扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让我在 VS 2017 中默认使用 .hpp 扩展名而不是 .h?

目前,当添加新文件时,它看起来像

  1. HFile.h 更改为 HFile.hpp 并在同一行将 #1078 更改为 Header File (.hpp) 并将 #1080 更改为 Header.hpp.保存文件.

  1. 返回文件资源管理器,将 hfile.h 重命名为 hfile.hpp.

  1. 现在您可以在 Visual C++ 菜单中获得预期的功能.

  1. 打开 Code 子文件夹.

  1. 使用文本编辑器打开 code.vsdir.

  1. 重复对最后一个 .vsdir 文件的更改:将 HFile.h 更改为 HFile.hpp 并在同一行更改 #1078Header File (.hpp) 并将 #1080 更改为 Header.hpp.保存文件.

  1. 现在您可以在代码菜单中获得预期的功能.

我不知道接下来的步骤实际上会发生什么变化,但看起来应该会改变某些事情.

  1. 导航备份一个文件夹到 vcprojectitems,然后另一个文件夹到 VC.打开 VCNewItems 文件夹.

  1. 使用文本编辑器打开 NewItems.vsdir.

  1. 重复对最后两个 .vsdir 文件的更改:将 HFile.h 更改为 HFile.hpp 并在同一行更改 #1078Header File (.hpp) 并将 #1080 更改为 Header.hpp.保存文件.

Is there a way that i can make the .hpp extension default instead of .h in VS 2017?

Currently, when adding a new file it looks like this.

Its not that its a huge issue, but having to write .hpp very single time manually its just inconvienent.

解决方案

This information comes from another question which is essentially the same, except that one is about VS2013. For VS2013 I think the first step should point to either %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcprojectitems\ OR %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE\VC\vcprojectitems\, but can't confirm.

  1. Navigate to %ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\vcprojectitems\. This will likely bring you to C:\Program Files (x86)\...

  2. Open VCProjectItems.vsdir in a text editor, such as Notepad++.

  1. Change HFile.h to HFile.hpp and on the same line change #1078 to Header File (.hpp) and change #1080 to Header.hpp. Save the file.

  1. Back in the file explorer, rename hfile.h to hfile.hpp.

  1. Now you get the intended functionality in the Visual C++ menu.

  1. Open the Code subfolder.

  1. Open code.vsdir with a text editor.

  1. Repeat the changes to the last .vsdir file: Change HFile.h to HFile.hpp and on the same line change #1078 to Header File (.hpp) and change #1080 to Header.hpp. Save the file.

  1. Now you get the intended functionality in the Code menu.

I have no idea what the next steps actually change, but it looks like it ought to change something.

  1. Navigate back up one folder to vcprojectitems, then another folder to VC. Open the VCNewItems folder.

  1. Open NewItems.vsdir with a text editor.

  1. Repeat the changes to the last two .vsdir files: Change HFile.h to HFile.hpp and on the same line change #1078 to Header File (.hpp) and change #1080 to Header.hpp. Save the file.

这篇关于你如何在 VS 2017 中默认 .hpp 扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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