【问题标题】:How do I set up Visual Studio with default headers and comments?如何使用默认标题和注释设置 Visual Studio?
【发布时间】:2015-10-30 00:35:29
【问题描述】:

我对使用 Visual Studio 还是很陌生。目前我正在使用 Visual Studio 2015 版本。目前,当我设置一个新的 C++ 控制台应用程序项目(关闭或打开 Precompiled 标头)时,它会显示以下内容:


// Name of project.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int main()

{

return 0;

}

每次我创建一个新项目时,我都不得不浪费时间输入我的标题信息和 cmets。每次创建新的 C++ 控制台应用程序项目时,我都希望它看起来像这样。


// *********************************************************************

// Name: 

// Description: 

// Date: 

// Class Section: 

// Title: 

// *********************************************************************

//Heading information
#include <iostream>
#include "stdlib.h"
#include "stdafx.h"
using namespace std;

//Main function

int main()

{

    //Pause system and end main function

    system("pause");

    return 0;

}

是否可以将 Visual Studio 2015 设置为在我每次创建新项目时显示上面的代码?谢谢

【问题讨论】:

  • 您可以复制该源代码,然后将该代码复制/粘贴到默认代码上。
  • 除了自己手动做的方法外,我相信ReSharper可以做到,但是VS本身不支持这个。

标签: c++ visual-studio interface header


【解决方案1】:
  1. 创建一个新的控制台应用程序。
  2. 在新文件中将文件编辑成您想要的样子。
  3. 在“文件”菜单中选择“导出模板...”。
  4. 浏览向导(为新模板选择名称等)
  5. 确保选中“自动将模板导入 Visual Studio”。
  6. 重启VS
  7. 选择“新建项目”
  8. 在左侧的树形控件中选择“Visual C++”
  9. 在中间的列表中选择您的新模板
  10. 通常的新项目内容(项目名称和位置等)

[注意:在我写这篇文章时,我正在 VS 2013 中查看它。我不记得它在 VS 2015 中发生了变化,但这是可能的。]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-19
    • 2016-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-24
    • 2011-12-01
    相关资源
    最近更新 更多