c++ - 如何使用默认标题和注释设置 Visual Studio?

标签 c++ visual-studio interface header

我刚开始使用 Visual Studio。目前我使用的是 Visual Studio 2015 版本。目前,当我设置一个新的 C++ 控制台应用程序项目(预编译 header 关闭或打开)时,它显示以下内容:


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

#include "stdafx.h"


int main()

{

return 0;

}

每次创建新项目时,我都必须浪费时间输入标题信息和注释。每次创建新的 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 设置为在我每次创建新项目时都显示上面的代码?谢谢

最佳答案

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

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

关于c++ - 如何使用默认标题和注释设置 Visual Studio?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33427089/

相关文章:

c# - 将 Visual Studio 2008 升级到 2013,将 .NET 3.5 升级到 4.5.1

android - Arraylist 作为接口(interface)中的参数在 Android RecyclerViewAdapter 中发生 NullPointer Exception

java - Clojure,反射 : Find classes that implement an interface

c++ - 例如,C++0x auto 关键字的含义?

visual-studio - 可以使用 Visual Studio 来调试 WinDBG 之类的子进程吗?

c++ - 为 QLineEdit 创建一个字符计数器

c++ - 获取进程用户名c++

json - Go中的排序接口(interface)

c++ - 在我的程序中使用for循环打印出矩阵的一个错误

c++ - 在指针上使用*运算符是否会创建拷贝?