Saturday, July 25, 2015

How do you create a C++ Console Application in Visual Studio 2013?

First of all get a copy of Visual Studio 2013 Community as described in the following posts.

Launch Visual Studio 2013 from its shortcut.


Click on New Project... to open the New Project window as shown.



Expand Visual C++ and under Win32 there are two templates as shown.


Change the name of the project from ConsoleApplicaiton1 to Testing and accept the default location and other items. Click OK.
Win32 Application Wizard opens to the Welcome window as shown. Read the readme.txt file.


Click Next.
The second page of the wizard (Application Settings)is displayed as shown.


Since you started with Windows Console application, the application type is already chosen-Console application. You can leave the other  options as they are. Click Finish.
The Project folders and files are created as shown in the left and Testing.cpp file is shown on the left. You can build the project and it will build as shown.

Include in the stdafx.h file which has only the following:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently

#pragma once
#include "targetver.h"

// TODO: reference additional headers your program requires here
Modify the Testing.cpp by replacing the existing code with the
following as shown in the next image.
int main()
 std::cout << "Hello Jay! ";
 std::cout << "I'm not a C++ programmer";



Click Build in the main menu. Build is successful as shown.


Click Ctrl+F5 to run without debugging. The command window is displayed with the output of the program written to it as shown.



No comments: