Visual C++ Run Steps
-
Upload
pugazhendie -
Category
Documents
-
view
239 -
download
0
Transcript of Visual C++ Run Steps
-
7/31/2019 Visual C++ Run Steps
1/12
STEPS TO COMPILE AND RUN A C++ PROGRAM
Compiler : Microsoft Visual C++ 6.0
Operating System : Windows
Step1: Start the Microsoft Visual C++ programming environment by clicking Start,
Microsoft Visual Studio, and Microsoft Visual C++.
The following is the startup screen for the Visual C++ environment.
1
-
7/31/2019 Visual C++ Run Steps
2/12
The icon in the upper left under the File choice is pressed to obtain an editor window.
When typing the C++ program source code no elements will be highlighted since the editor
treats the source code as a text file at this point.If you wish the keyword highlighting to be activated you should explicitly save the file as a
.cpp file. See the explanation a few pages ahead.
2
Click this icon to
obtain an editorwindow to type in
your C++ programsource.
This window is the
editor window whenthe editor is active.This window is the
'class' window when
working on a project.
This window is for messages from thecompiler/loader, especially error messages
for typographical errors.
-
7/31/2019 Visual C++ Run Steps
3/12
After typing the C++ source code it should be saved as a .cpp file. The name should besomewhat original. This does not include lab1.cpp, program1.cpp, or assignment.cpp.
The .cpp extension is necessary for the following steps to work correctly since the compiler
expects that extension for source files it should compile.
3
Editor window. Type your
source code here.
-
7/31/2019 Visual C++ Run Steps
4/12
4
Source code for C++ program(taken from "Problem
Solving with C++"
Use the File menu item.
Use the SaveAs optionto save the file
-
7/31/2019 Visual C++ Run Steps
5/12
5
Choose a directory to save
the source file and otherfiles that Visual C++
creates for you.
Pick a representative
file name with the.cpp extension
After choosing the
directory and typing in a
program name, click onsave.
-
7/31/2019 Visual C++ Run Steps
6/12
6
You now need to Build
the program to obtain anexecutable.
-
7/31/2019 Visual C++ Run Steps
7/12
7
Visual C++ requires the
program be part of a'project workspace' and is
offering to create one for
you.Click on Yes.
-
7/31/2019 Visual C++ Run Steps
8/12
After making the correction you should build the executable.
8
Message window for Visual C++. The compiler
is complaining here about a misspelled
keyword. Use the editor to correct the typingmistake.
Improperly spelled keyword
causes the error message
displayed below. It should be
'char'.
The class window
in populated nowthat a project is
underway.
-
7/31/2019 Visual C++ Run Steps
9/12
9
Use the Build option on the menu to create
the executable. As you can see additional
menu choices are available now that theprogram is part of a project.
-
7/31/2019 Visual C++ Run Steps
10/12
10
For a successful build no errors should be found by
the compiler or the linker. You can now execute the
program.
-
7/31/2019 Visual C++ Run Steps
11/12
11
Under the Build menu is anExecute option.
-
7/31/2019 Visual C++ Run Steps
12/12
12
The program will execute in its own window. Thenumbers for the number of pods and peas in the pod
were entered and the program printed the information.
To return to the Visual C++ environment press a key
and the execution window will disappear.