You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/vscpp-step-2-build.md
+10-11Lines changed: 10 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,17 @@
2
2
title: Build and run a C++ console app project
3
3
description: "Build and run a Hello World console app in Visual C++"
4
4
ms.custom: "mvc"
5
-
ms.date: 07/05/2023
5
+
ms.date: 06/28/2024
6
6
ms.topic: "tutorial"
7
7
ms.devlang: "cpp"
8
8
---
9
9
# Build and run a C++ console app project
10
10
11
-
You've created a C++ console app project and entered your code. Now you can build and run it within Visual Studio. Then, run it as a stand-alone app from the command line.
11
+
In [Create a C++ console app project](vscpp-step-1-create.md) you created a C++ console app project and entered your code. Now you can build and run it within Visual Studio. Then, run it as a stand-alone app from the command line.
12
12
13
13
## Prerequisites
14
14
15
15
- Have Visual Studio with the Desktop development with C++ workload installed and running on your computer. If it's not installed, follow the steps in [Install C++ support in Visual Studio](vscpp-step-0-installation.md).
16
-
17
16
- Create a "Hello, World!" project. By default, it contains code to print `Hello World!`. If you haven't done this step yet, follow the steps in [Create a C++ console app project](vscpp-step-1-create.md).
18
17
19
18
If Visual Studio looks like this, you're ready to build and run your app:
@@ -24,11 +23,11 @@ If Visual Studio looks like this, you're ready to build and run your app:
24
23
25
24
## Build and run your code in Visual Studio
26
25
27
-
1. To build your project, choose **Build Solution**from the **Build** menu. The **Output** window shows the results of the build process.
26
+
1. To build your project, from the main menu choose **Build**> **Build Solution**. The **Output** window shows the results of the build process.
28
27
29
28
:::image type="complex" source="media/vscpp-build-solution.gif" alt-text="Animated screenshot showing the sequence of actions taken to build a project in Visual Studio.":::
30
29
First, Build is selected from the main menu. Then Build Solution is selected. The Output window shows the build output messages, including that the build is successful.
31
-
:::image-end:::
30
+
:::image-end:::
32
31
33
32
1. To run the code, on the menu bar, choose **Debug**, **Start without debugging**.
34
33
@@ -38,7 +37,7 @@ If Visual Studio looks like this, you're ready to build and run your app:
38
37
39
38
A console window opens and then runs your app. When you start a console app in Visual Studio, it runs your code, then prints "Press any key to continue . . ." to give you a chance to see the output.
40
39
41
-
Congratulations! You've created your first "Hello, world!" console app in Visual Studio! Press a key to dismiss the console window and return to Visual Studio.
40
+
Congratulations! You created your first "Hello, world!" console app in Visual Studio! Press a key to dismiss the console window and return to Visual Studio.
42
41
43
42
[I ran into a problem.](#build-and-run-your-code-in-visual-studio-issues)
44
43
@@ -50,12 +49,12 @@ Normally, you run console apps at the command prompt, not in Visual Studio. Once
50
49
51
50
::: moniker range="<msvc-170"
52
51
53
-
2. In the **File Explorer** window, open the `Debug` folder. This folder contains your app, `HelloWorld.exe`, and debugging files. Hold down the **Shift** key and right-click on `HelloWorld.exe` to open the context menu. Choose **Copy as path** to copy the path to your app to the clipboard.
52
+
2. In the **File Explorer** window, open the `Debug` folder. This folder contains your app, `HelloWorld.exe`, and debugging files. Hold down the **Shift** key and right-click on `HelloWorld.exe` to open the context menu. Choose **Copy as path** to copy the path to your app to the clipboard. If you see `HelloWorld.exe.recipe`, it's because you did the **Open Folder in File Explorer** step on the HelloWorld *project* instead of the HelloWorld *solution*. Navigate up a level in File Explorer to get to the solution folder. This folder also contains a `Debug` folder, where `HelloWorld.exe` is.
54
53
55
54
::: moniker-end
56
55
::: moniker range=">=msvc-170"
57
56
58
-
2. In the **File Explorer** window, open the `x64` folder and then the `Debug` folder. This folder contains your app, `HelloWorld.exe`, and debugging files. Hold down the **Shift** key and right-click on `HelloWorld.exe` to open the context menu. Choose **Copy as path** to copy the path to your app to the clipboard.
57
+
2. In the **File Explorer** window, open the `x64` folder and then the `Debug` folder. This folder contains your app, `HelloWorld.exe`, and debugging files. Hold down the **Shift** key and right-click on `HelloWorld.exe` to open the context menu. Choose **Copy as path** to copy the path to your app to the clipboard. If you see `HelloWorld.exe.recipe`, it's because you did the **Open Folder in File Explorer** step on the HelloWorld *project* instead of the HelloWorld *solution*. Navigate up a level in File Explorer to get to the solution folder. This folder also contains a `x64\Debug\` folder, where `HelloWorld.exe` is.
59
58
60
59
::: moniker-end
61
60
@@ -73,7 +72,7 @@ Congratulations, you built and ran a console app in Visual Studio!
73
72
74
73
## Next Steps
75
74
76
-
Once you've built and run this simple app, you're ready for more complex projects. For more information, see [Using the Visual Studio IDE for C++ Desktop Development](../ide/using-the-visual-studio-ide-for-cpp-desktop-development.md). It has more detailed walkthroughs that explore the capabilities of Microsoft C++ in Visual Studio.
75
+
Once you build and run this simple app, you're ready for more complex projects. For more information, see [Using the Visual Studio IDE for C++ Desktop Development](../ide/using-the-visual-studio-ide-for-cpp-desktop-development.md). It has more detailed walkthroughs that explore the capabilities of Microsoft C++ in Visual Studio.
77
76
78
77
## Troubleshooting guide
79
78
@@ -89,14 +88,14 @@ If red squiggles appear under anything in the source code editor, the build may
89
88
90
89
::: moniker range="<msvc-170"
91
90
92
-
If the path shown in File Explorer ends in `\HelloWorld\HelloWorld`, you've opened the HelloWorld *project* instead of the HelloWorld *solution*. You'll be confused by a `Debug` folder that doesn't contain your app. Navigate up a level in File Explorer to get to the solution folder, the first *HelloWorld* in the path. This folder also contains a `Debug` folder, where your app is.
91
+
If the path shown in File Explorer ends in `\HelloWorld\HelloWorld`, you opened the HelloWorld *project* instead of the HelloWorld *solution*. You won't see your app in th `Debug` folder. Navigate up a level in File Explorer to get to the solution folder, the first *HelloWorld* in the path. This folder also contains a `Debug` folder, where your app is.
93
92
94
93
You can also navigate to the solution `Debug` folder at the command line to run your app. Your app won't run from other directories without specifying the path to the app. However, you can copy your app to another directory and run it from there. It's also possible to copy it to a directory specified by your `PATH` environment variable, then run it from anywhere.
95
94
96
95
::: moniker-end
97
96
::: moniker range=">=msvc-170"
98
97
99
-
If the path shown in File Explorer ends in `\HelloWorld\HelloWorld`, you've opened the HelloWorld *project* instead of the HelloWorld *solution*. You'll be confused by a `x64\Debug` folder that doesn't contain your app. Navigate up a level in File Explorer to get to the solution folder, the first `HelloWorld` in the path. This folder also contains a `x64\Debug` folder, where your app is.
98
+
If the path shown in File Explorer ends in `\HelloWorld\HelloWorld`, you opened the HelloWorld *project* instead of the HelloWorld *solution*. You won't see your app in the `x64\Debug` folder. Navigate up a level in File Explorer to get to the solution folder, the first `HelloWorld` in the path. This folder also contains a `x64\Debug` folder, where your app is.
100
99
101
100
You can also navigate to the solution `x64\Debug` folder at the command line to run your app. Your app won't run from other directories without specifying the path to the app. However, you can copy your app to another directory and run it from there. It's also possible to copy it to a directory specified by your `PATH` environment variable, then run it from anywhere.
Copy file name to clipboardExpand all lines: docs/overview/visual-cpp-language-conformance.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -530,8 +530,8 @@ A group of papers listed together indicates a Standard feature along with one or
530
530
| Alignment specifiers `<stdalign.h>`| VS 2019 16.8 <sup>[C11](#note_C11), [2104](#note_2104)</sup> |
531
531
| `aligned_alloc`| No <sup>[M](#note_M)</sup> |
532
532
| No return specifiers `<stdnoreturn.h>`| VS 2019 16.8 <sup>[C11](#note_C11), [2104](#note_2104)</sup> |
533
-
| Threading support `<threads.h>`|No|
534
-
| Atomic support `<stdatomic.h>`|No|
533
+
| Threading support `<threads.h>`|yes|
534
+
| Atomic support `<stdatomic.h>`|experimental|
535
535
| `char16_t`, `char32_t``<uchar.h>`| VS 2019 16.8 <sup>[C11](#note_C11)</sup> |
536
536
| `gets()` removed | VS 2019 16.8 <sup>[C11](#note_C11), [N](#note_N)</sup> |
537
537
| `gets_s()`| VS 2019 16.8 <sup>[C11](#note_C11)</sup> |
@@ -541,6 +541,7 @@ A group of papers listed together indicates a Standard feature along with one or
541
541
| `quick_exit`| VS 2019 16.8 <sup>[C11](#note_C11)</sup> |
542
542
| `<complex.h>` macros | VS 2019 16.8 <sup>[C11](#note_C11)</sup> |
543
543
| floating point characteristics `<float.h>`| VS 2019 16.8 <sup>[C11](#note_C11)</sup> |
544
+
| C11 threads `<threads.h>`| VS 2022 17.8 <sup>[C11](#note_C11)</sup> |
544
545
545
546
### Supported values
546
547
@@ -576,7 +577,7 @@ A group of papers listed together indicates a Standard feature along with one or
576
577
577
578
<aname="note_A"></a> **A** In [`/std:c++14`](../build/reference/std-specify-language-standard-version.md) mode, dynamic exception specifications remain unimplemented, and `throw()` is still treated as a synonym for `__declspec(nothrow)`. In C++17, dynamic exception specifications were mostly removed by P0003R5, except for one vestige: `throw()` is deprecated and required to behave as a synonym for **`noexcept`**. In [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode, MSVC now conforms to the Standard by giving `throw()` the same behavior as **`noexcept`**, that is, enforcement via termination.
578
579
579
-
The compiler option [`/Zc:noexceptTypes`](../build/reference/zc-noexcepttypes.md) requests the old behavior of `__declspec(nothrow)`. It's likely that `throw()` will be removed in a future version of C++. To help with migrating code in response to these changes in the Standard and the Microsoft implementation, new compiler warnings for exception specification issues have been added under [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) and [`/permissive-`](../build/reference/permissive-standards-conformance.md).
580
+
The compiler option [`/Zc:noexceptTypes`](../build/reference/zc-noexcepttypes.md) requests the old behavior of `__declspec(nothrow)`. It's likely that `throw()` will be removed in a future version of C++. To help with migrating code in response to these changes in the Standard and the Microsoft implementation, new compiler warnings for exception specification issues are added under [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) and [`/permissive-`](../build/reference/permissive-standards-conformance.md).
580
581
581
582
<aname="note_B"></a> **B** Supported in [`/permissive-`](../build/reference/permissive-standards-conformance.md) mode in Visual Studio 2017 version 15.7. For more information, see [`Two-phase name lookup support comes to MSVC`](https://devblogs.microsoft.com/cppblog/two-phase-name-lookup-support-comes-to-msvc/).
0 commit comments