【问题标题】:Visual Studio - C++ New File Default CodeVisual Studio - C++ 新文件默认代码
【发布时间】:2020-09-09 20:24:16
【问题描述】:

大家好,我有一个舒适问题是 Visual Studio 2017(由于学校要求,我使用 2017)。 当我开始一个新的 C++ 项目或 C++ 文件时,我总是得到默认代码:

// ConsoleApplication4.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>

int main()
{
    std::cout << "Hello World!\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file

每次都删除它对我来说很烦人,我很高兴知道如何删除默认代码。我搜索了 Internet 和 Microsoft MSDN,但没有找到任何解决方案。感谢您的帮助,这个网站对我帮助很大!

【问题讨论】:

标签: c++ visual-studio visual-c++


【解决方案1】:

创建空项目有两种方法。

1.1 创建项目。

1.2 编辑项目,直到它准备好导出为模板。例如,您可能想要编辑代码文件以指示应在何处进行参数替换。请参阅如何:替换模板中的参数。

1.3 在Project 菜单上,选择Export Template

导出Template Wizard 打开。

1.4 在选择模板类型页面上,选择Project Template。选择要导出到模板的项目,然后选择Next

1.5 在“选择模板选项”页面上,输入模板的名称和可选描述、图标和预览图像。这些项目将出现在您创建新项目的对话框中。选择Finish

  1. 您可以使用Windows Desktop Wizard

然后选择Empty Project

【讨论】:

    猜你喜欢
    • 2019-10-29
    • 2018-03-07
    • 1970-01-01
    • 1970-01-01
    • 2021-11-22
    • 1970-01-01
    • 1970-01-01
    • 2012-02-03
    • 1970-01-01
    相关资源
    最近更新 更多