Skip to content
/Hello World in C++ using Visual Studio 2017
Hello World in C++ using Visual Studio 20172019-04-05T09:46:32-07:00

Get help with Visual Studio

Support links

Top issue FAQs

Hello World in C++ using Visual Studio 2017

Thank you for downloading Visual Studio and starting your first C++ journey!

  1. First, understand the layout and views once you launch Visual Studio 2017:

    screenshot of Visual Studio 2017 launch window

  2. Next, review the standard build process for a Visual Studio project: graphic for standard build process for a Visual Studio project
  3. If C++ is not an already installed language in Visual Studio, you need to install Desktop development with C++ through the Visual Studio Installer:

    screenshot of Desktop development with C++ installer

  4. After installing the Desktop development with C++ workload, you can choose the Win32 Console Application template and create your HelloWorld project:

    screenshot of Win32 Console Application

  5. Click Finish to exit the Win32 Application Wizard

    screenshot of Win32 Application Wizard

  6. You can see your first C++ project:

    screenshot of C++ project

  7. Replace the code with the following:
    #include "stdafx.h"
    #include <iostream> 
    using namespace std;    
        int main()      
            cout << "Hello World! ";    
            return 0;      
  8. Next, add a breakpoint by clicking the grey area in front of line 12:

    screenshot of breakpoint

  9. Compile and run your project by clicking the green triangle in the tool bar (Local Windows Debugger) or press F5. Visual Studio allows single-click for build and debugging.

    Click Yes to build the project:

    screenshot of build and debugging window

  10. You can see “Hello World!” in the console window.

    screenshot of console window.


If the console window closes immediately, you need to set the breakpoint in step 8.

If you are on Windows 8.1, you need to re-run the installer for Visual Studio, click modify, select languages, and choose C++.

Congratulations on your first C++ project!

Support links