Skip to content

Commit 366d269

Browse files
authored
Merge pull request #3463 from MicrosoftDocs/FromPublicMasterBranch
Confirm merge from FromPublicMasterBranch to master to sync with https://github.com/MicrosoftDocs/cpp-docs (branch master)
2 parents 9af0458 + a6798e3 commit 366d269

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/build/walkthrough-compiling-a-native-cpp-program-on-the-command-line.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Walkthrough: Compiling a Native C++ Program on the Command Line"
33
description: "Use the Microsoft C++ compiler from a command prompt."
44
ms.custom: "conceptual"
5-
ms.date: "04/02/2020"
5+
ms.date: 03/25/2021
66
helpviewer_keywords: ["native code [C++]", "Visual C++, native code", "compiling programs [C++]", "command-line applications [C++], native"]
77
ms.assetid: b200cfd1-0440-498f-90ee-7ecf92492dc0
88
---
@@ -57,11 +57,11 @@ Before you can build a C or C++ program on the command line, verify that the too
5757
5858
### Create a Visual C++ source file and compile it on the command line
5959

60-
1. In the developer command prompt window, enter `md c:\hello` to create a directory, and then enter `cd c:\hello` to change to that directory. This directory is where your source file and the compiled program are created in.
60+
1. In the developer command prompt window, enter `md c:\hello` to create a directory, and then enter `cd c:\hello` to change to that directory. This directory is where both your source file and the compiled program get created.
6161

6262
1. Enter `notepad hello.cpp` in the command prompt window.
6363

64-
Choose **Yes** when Notepad prompts you to create a file. This step opens a blank Notepad window, ready for you to enter your code in a file named hello.cpp.
64+
Choose **Yes** when Notepad prompts you to create a new file. This step opens a blank Notepad window, ready for you to enter your code in a file named hello.cpp.
6565

6666
1. In Notepad, enter the following lines of code:
6767

@@ -97,7 +97,10 @@ Before you can build a C or C++ program on the command line, verify that the too
9797
9898
```
9999

100-
The dates and other details will differ on your computer. If you don't see your source code file, *hello.cpp*, make sure you've changed to the *c:\\hello* directory you created. In Notepad, make sure that you saved your source file in this directory. Also make sure that you saved the source code with a *`.cpp`* file name extension, not a *`.txt`* extension.
100+
The dates and other details will differ on your computer.
101+
102+
> [!NOTE]
103+
> If you don't see your source code file, *`hello.cpp`*, make sure the current working directory in your command prompt is the *`C:\hello`* directory you created. Also make sure that this is the directory where you saved your source file. And make sure that you saved the source code with a *`.cpp`* file name extension, not a *`.txt`* extension. Your source file gets saved in the current directory as a *`.cpp`* file automatically if you open Notepad at the command prompt by using the **`notepad hello.cpp`** command. Notepad's behavior is different if you open it another way: By default, Notepad appends a *`.txt`* extension to new files when you save them. It also defaults to saving files in your *Documents* directory. To save your file with a *`.cpp`* extension in Notepad, choose **File** > **Save As**. In the **Save As** dialog, navigate to your *`C:\hello`* folder in the directory tree view control. Then use the **Save as type** dropdown control to select **All Files (\*.\*)**. Enter *`hello.cpp`* in the **File name** edit control, and then choose **Save** to save the file.
101104
102105
1. At the developer command prompt, enter `cl /EHsc hello.cpp` to compile your program.
103106

0 commit comments

Comments
 (0)