|
1 | 1 | --- |
2 | 2 | title: "How to: Create a C++ Project from Existing Code" |
3 | | -ms.date: "11/04/2016" |
4 | | -helpviewer_keywords: ["C++, creating projects from existing code"] |
| 3 | +ms.date: "01/15/2019" |
| 4 | +helpviewer_keywords: ["C++, creating projects from existing code", "Create New Project From Existing Code Files Wizard, project settings"] |
| 5 | +f1_keywords: ["vc.appwiz.importwiz.location", "vc.appwiz.importwiz.appsettings", "vc.appwiz.importwiz.debugsettings", "vc.appwiz.importwiz.releasesettings"] |
5 | 6 | ms.assetid: e328a938-395c-48ea-9e35-dd433de12b31 |
6 | 7 | --- |
7 | 8 | # How to: Create a C++ Project from Existing Code |
8 | 9 |
|
9 | | -In Visual Studio, you can port your existing code files into a Visual C++ project by using the **Create New Project From Existing Code Files** wizard. This wizard is not available in older Express editions of Visual Studio. This wizard creates a new solution and project that uses the MSBuild system to manage your source files and build configuration. |
| 10 | +In Visual Studio, you can port your existing code files into a Visual C++ project by using the **Create New Project From Existing Code Files** wizard. This wizard isn't available in older Express editions of Visual Studio. This wizard creates a solution and project that uses the MSBuild system to manage your source files and build configuration. |
10 | 11 |
|
11 | | -Porting your existing code files into a Visual C++ project enables you to use all of the native MSBuild project management features built into the IDE. If you prefer to use your existing build system, such as nmake makefiles, CMake, or alternatives, you can use the Open Folder option instead. For more information, see [Open Folder projects in Visual C++](../ide/non-msbuild-projects.md). Both options let you use IDE features such as [IntelliSense](/visualstudio/ide/using-intellisense) and [Project Properties](../ide/working-with-project-properties.md). |
| 12 | +Porting your existing code files into a Visual C++ project enables you to use the native MSBuild project management features built into the IDE. If you prefer to use your existing build system, such as nmake makefiles, CMake, or alternatives, you can use the Open Folder option instead. For more information, see [Open Folder projects in Visual C++](../ide/non-msbuild-projects.md). Both options let you use IDE features such as [IntelliSense](/visualstudio/ide/using-intellisense) and [Project Properties](../ide/working-with-project-properties.md). |
12 | 13 |
|
13 | 14 | ### To create a C++ project from existing code |
14 | 15 |
|
15 | | -1. On the **File** menu, point to **New**, and then click **Project From Existing Code**. |
| 16 | +1. On the **File** menu, select **New** > **Project From Existing Code**. |
16 | 17 |
|
17 | | -1. On the first page of the **Create New Project from Existing Code Files** wizard, select **Visual C++** in the **What type of project would you like to create** list. Choose **Next** to continue. |
| 18 | +1. On the first page of the **Create New Project from Existing Code Files** wizard, select **Visual C++** in the **What type of project would you like to create?** list. Choose **Next** to continue. |
18 | 19 |
|
19 | | -1. Specify your project location and the directory for your source files. For details on this page, see [Specify Project Location and Source Files, Create New Project From Existing Code Files Wizard](../ide/specify-project-location-and-source-files.md). Choose **Next** to continue. |
| 20 | +1. Specify your project location, the directory for your source files, and the kinds of files the wizard imports into the new project. Choose **Next** to continue. |
20 | 21 |
|
21 | | -1. Specify the project settings to use. For details on this page, see [Specify Project Settings, Create New Project From Existing Code Files Wizard](../ide/specify-project-settings-create-new-project-from-existing-code-files-wizard.md). Choose **Next** to continue. |
| 22 | + | Setting | Description | |
| 23 | + | ----------------------------- | ------------------------------------------------- | |
| 24 | + | **Project file location** | Specifies the directory path of the new project. This location is where the wizard deposits all the files (and subdirectories) of the new project.<br/><br/>Select **Browse** to display the **Project file location** dialog, which helps you specify the directory that contains the new project. This control enables you to navigate to the right folder.| |
| 25 | + | **Project name** | Specifies the name of the new project. Project files, which have file extensions such as .vcxproj adopts this name and existing code files keep their original name. | |
| 26 | + | **Add files to the project from these folders** | Check to set the wizard to copy existing code files from their original directories (that are specified in the list box below this control) into the new project.<br/><br/>Check **Add Subfolders** to specify to copy code files from all subdirectories of the directory listed **Folder** column into the new project. The **Folder** column indicates the path to the directory that contains existing code files to copy into the new project. This column lists all the directories that the wizard searches for existing code files.<br/><br/>Select **Add** to display the **Add files to the project from this folder** dialog box, which helps you the specify directories that the wizard searches for existing code files.<br/><br/>Select **Remove** to delete the directory path that is selected in the list box left of this control.<br/><br/>In the **File types to add to the project** box, specify the kinds of files that the wizard adds to the new project based on the given file extensions. File extensions are preceded with the asterisk wildcard character, and are delimited in the list of file extensions by a semicolon. | |
| 27 | + | **Show all files in Solution Explorer** | Specifies that all files in the new project to be visible and displayed in the **Solution Explorer** window. This option is enabled by default. | |
22 | 28 |
|
23 | | -1. Specify the Debug configuration settings to use. For details on this page, see [Specify Debug Configuration Settings, Create New Project From Existing Code Files Wizard](../ide/specify-debug-configuration-settings.md). Choose **Next** to continue. |
| 29 | +  |
24 | 30 |
|
25 | | -1. Specify the Release configuration settings to use. For details on this page, see [Specify Release Configuration Settings, Create New Project From Existing Code Files Wizard](../ide/specify-release-configuration.md). Choose **Finish** to generate the new project. |
| 31 | +1. Specify the project settings to use such as the build environment for the new project and the build settings to match a specific type of new project to generate. Choose **Next** to continue. |
26 | 32 |
|
27 | | -## See Also |
| 33 | + | Setting | Description | |
| 34 | + | ----------------------------- | ------------------------------------------------- | |
| 35 | + | **Use Visual Studio** | Specifies to use build tools that are included in Visual Studio for building the new project. This option is selected by default.<br/><br/>Select **Project Type** to specify the type of project that the wizard generates.<br/><br/>Here choose from **Windows application project**, indicates that the wizard generates a project for an executable Windows application, **Console application project**, indicates that the wizard generates a project for a console application, **Dynamically linked library (DLL) project**, indicates that the wizard generates a project for an empty dynamic link library application, or **Static library (LIB) project**, indicates that the wizard generates a project for a static library application.<br/><br/>Check **Add support for ATL** to add ATL support to the new project.<br/><br/>Check **Add support for MFC** to add MFC support to the new project.<br/><br/>Check **Add support for the Common Language Runtime** to add CLR programming support to the new project.<br/><br/>Here choose from **Common Language Runtime**, specifies the new project to be compliant with CLR features, such as **Common Language Runtime (old syntax)**, which specifies the new project to be compliant with Managed Extensions for C++ syntax, which is CLR programming syntax before Visual C++ 2005.| |
| 36 | + | **Use external build system** | Specifies to use build tools that aren't included in Visual Studio for building the new project. When this option is selected, you can specify build command lines on the **Specify Debug Configuration Settings** and **Specify Release Configuration Settings** pages. | |
28 | 37 |
|
29 | | -[Specify Project Location and Source Files, Create New Project From Existing Code Files Wizard](../ide/specify-project-location-and-source-files.md)<br> |
30 | | -[Specify Project Settings, Create New Project From Existing Code Files Wizard](../ide/specify-project-settings-create-new-project-from-existing-code-files-wizard.md)<br> |
31 | | -[Specify Debug Configuration Settings, Create New Project From Existing Code Files Wizard](../ide/specify-debug-configuration-settings.md)<br> |
32 | | -[Specify Release Configuration Settings, Create New Project From Existing Code Files Wizard](../ide/specify-release-configuration.md) |
| 38 | +  |
| 39 | + |
| 40 | + > [!NOTE] |
| 41 | + > When the **Use External Build System** option is checked, the IDE does not build the new project, so the /D, /I, /FI, /AI, or /FU options are not required for compilation. However, these options must be set correctly in order for IntelliSense to function properly. |
| 42 | +
|
| 43 | +1. Specify the Debug configuration settings to use. Choose **Next** to continue. |
| 44 | + |
| 45 | + | Setting | Description | |
| 46 | + | ----------------------------- | ------------------------------------------------- | |
| 47 | + | **Build command line** | Specifies the command line that builds the new project. Enter the name of the compiler (plus any switches or arguments) or the build scripts that you want to use to build the new project. | |
| 48 | + | **Rebuild command line** | Specifies the command line that rebuilds the new project. | |
| 49 | + | **Clean command line** | Specifies the command line to delete support files generated by the build tools for the new project. | |
| 50 | + | **Output (for debugging)** | Specifies the directory path of the output files for the Debug configuration of the new project. | |
| 51 | + | **Preprocessor definitions (/D)** | Defines preprocessor symbols for the new project, see [/D (Preprocessor Definitions)](../build/reference/d-preprocessor-definitions.md). | |
| 52 | + | **Include search path (/I)** | Specifies directory paths to add to the list of directories that the compiler searches to resolve file references passed to preprocessor directives in the new project, see [/I (Additional Include Directories)](../build/reference/i-additional-include-directories.md). | |
| 53 | + | **Forced included files (/FI)** | Specifies header files to process when building the new project, see [/FI (Name Forced Include File)](../build/reference/fi-name-forced-include-file.md). | |
| 54 | + | **.NET assembly search path (/AI)** | Specifies the directory paths that the compiler searches to resolve .NET assembly references passed to preprocessor directives in the new project, see [/AI (Specify Metadata Directories)](../build/reference/ai-specify-metadata-directories.md). | |
| 55 | + | **Forced using .NET assemblies (/FU)** | Specifies .NET assemblies to process when building the new project, see [/FU (Name Forced #using File)](../build/reference/fu-name-forced-hash-using-file.md). | |
| 56 | + |
| 57 | +  |
| 58 | + |
| 59 | + > [!NOTE] |
| 60 | + > The **Build command line**, **Rebuild command line**, **Clean command line**, and **Output (for debugging)** settings are only enabled when the **Use external build system** option is selected in the **Specify Project Settings** page. |
| 61 | +
|
| 62 | +1. Specify the Release configuration settings to use. The settings are the same as the Debug configuration settings. Choose **Finish** to generate the new project. |
| 63 | + |
| 64 | + > [!NOTE] |
| 65 | + > Here you can heck **Same as Debug configuration** to specify that the wizard will generate Release configuration project settings identical to Debug configuration project settings. This option is checked by default. All other options on this page are inactive unless you uncheck this box. |
0 commit comments