/Hello World in C++ using Visual Studio 2017
Technical Support & FAQs | Visual Studio IDE 2018-06-04T12:13:16+00:00

Get help with Visual Studio

Contact us

Visual Studio 2017 FAQ

Hello World in C++ using Visual Studio 2017

Thank you for downloading Visual Studio and start 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 Wizardscreenshot of Win32 Application Wizard
  6. You can see your first C++ project:screenshot of C++ project
  7. Replace the code with below lines:
    #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 a "Hello World!" in the console window.screenshot of console window.
Troubleshooting:If the console window immediately closes, 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! Please let us know whether you find this article useful or not. Thank you!

Contact Us!