Loading

C++: Creating a Console Application in Visual Studio 2013

Creating a Console Application in Visual Studio 2013

In this C++ video tutorial, we show how to create an empty C++ project in Visual Studio 2013, add a .cpp file to the project, and compile a simple program. These steps will be used at the start of most of the remaining videos. To follow along with this lesson, you will need to have Visual Studio 2013 installed.

  1. To begin, locate the icon for Visual Studio 2013 in the Start menu and left-click it to open Visual Studio 2013.
  2. With Visual Studio open, left-click FILE in the menubar, mouse over New in the menu, and left-click Project in the submenu.
    FILE->New->Project
  3. This pops up the New Project dialog. Left-click Visual C++ under Templates in the left-hand pane, and left-click Win32 Console Application in the center pane.
  4. Change the name of the project by left-clicking the box next to Name: and typing "Console C++ Lesson 1" into it.
    Setting the Project Name
  5. You can select a new folder location for your project, if you like, by left-clicking the Browse button to open a location dialog. When you are done, left-click the OK button to go on.
  6. This will open the Win32 Application Wizard shown here. Left-click the Next button to continue.
  7. That will take you to the Applications Settings, where you can left-click the check box next to Empty Project and left-click the Finish button to create the project.
    Set the Project as Empty
  8. Now you should see your new empty project open. To add the code file, left-click PROJECT in the menubar and left-click Add New Item... in the menu.
  9. This opens the Add New Item dialog. In it, left-click Visual C++ in the left-hand pane and left-click C++ File(.cpp) in the center pane.
  10. Left-click the box next to Name: and type "main.cpp" into it. Then left-click the Add button to create the new code file and add it to the project.
  11. The IDE should have the file "main.cpp" open for editing. Type these lines of code into the pane:

    #include <iostream>
    
    int main() {
        std::cout << "Deus Caritas Est!" << std::endl;
        std::cin.get();
        return 0;
    }
    

  12. Finally, compile and execute the code by left-clicking DEBUG in the menubar and left-clicking Start Without Debugging in the submenu.
  13. You should see a dialog asking you whether you would like to build the program. Left-click the Yes button.
  14. When the program finishes compiling and executes, you should see a console window like this one:
    Program Output