我刚开始使用 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 设置为在我每次创建新项目时都显示上面的代码?谢谢
最佳答案
- 创建一个新的控制台应用程序。
- 在新文件中根据需要编辑文件。
- 在"file"菜单中选择“导出模板...”。
- 完成向导(为您的新模板选择一个名称等)
- 确保选中“自动将模板导入 Visual Studio”。
- 重启VS
- 选择“新项目”
- 在左侧的树形控件中选择“Visual C++”
- 在中间的列表中选择您的新模板
- 通常的新项目内容(项目的名称和位置等)
[注意:在我写这篇文章时,我正在 VS 2013 中查看它。我不记得它在 VS 2015 中发生了变化,但这是可能的。]
关于c++ - 如何使用默认标题和注释设置 Visual Studio?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33427089/