新建 Linux 项目Create a New Linux Project

为 Linux 编码时,可以选择创建 Visual Studio 项目还是 CMake 项目。When coding for Linux, you have the choice of creating a Visual Studio project, or a CMake project. 本主题介绍如何创建 Visual Studio 项目。This topic describes how to create a Visual Studio project. 有关 CMake 项目的信息,请参阅配置 Linux CMake 项目For information about CMake Projects, see Configure a Linux CMake Project .

若要在 Visual Studio 中新建 Linux 项目,请执行以下操作:To create a new Linux project in Visual Studio, do the following:

  1. 在 Visual Studio 中选择“文件 > 新建项目”,或按 Ctrl + Shift + NSelect File > New Project in Visual Studio, or press Ctrl + Shift + N.
  2. 依次选择“Visual C++ > 跨平台 > Linux”节点,再选择要创建的项目类型,输入名称/位置,再单击“确定”。Select the Visual C++ > Cross Platform > Linux node and then select the project type you would like to create, enter a Name/Location, and click OK.

    新建 Linux 项目

    项目类型Project Type 说明Description
    Blink (Raspberry)Blink (Raspberry) 项目针对 Raspberry Pi 设备,写入示例代码以让 LED 闪烁Project targeted for a Raspberry Pi device with sample code written to blink an LED
    控制台应用程序 (Linux)Console Application (Linux) 项目针对任何 Linux 计算机,写入示例代码以将文本输出到控制台Project targeted for any Linux computer with sample code written to output text to the console
    空项目 (Linux)Empty Project (Linux) 项目针对任何 Linux 计算机,未写入任何示例代码Project targeted for any Linux computer with no sample code written
    生成文件项目 (Linux)Makefile Project (Linux) 项目针对任何 Linux 计算机,使用标准生成文件的生成系统生成Project targeted for any Linux computer which will be built using a standard Makefile build system