Upload
isabella-carson
View
215
Download
2
Tags:
Embed Size (px)
Citation preview
Our EnvironmentOur Environment
We will exercise on We will exercise on Microsoft Visual C++ v.6Microsoft Visual C++ v.6
because that is what we have in the univ.because that is what we have in the univ. but there are many free compilers, too.but there are many free compilers, too.
Visual C++ (v6)Visual C++ (v6)
Visual C++ (v6)Visual C++ (v6)
New.. Ctrl+N
Visual C++ (v6)Visual C++ (v6)
Choose: “Win32 Console Application”
Project and file directory
project title(name of .exe)
Visual C++ (v6)Visual C++ (v6)
Visual C++ (v6)Visual C++ (v6)
New source file will be included in the project
Visual C++ (v6)Visual C++ (v6)
Choose: “c++ source file”
Give a file name with
extension .c
Visual C++ (v6)Visual C++ (v6)
Write your program here
Visual C++ (v6)Visual C++ (v6)
Compile the C file
Visual C++ (v6)Visual C++ (v6)
Build an executable (.exe)
file.
Visual C++ (v6)Visual C++ (v6)
Run the executable file (.exe). When this menu is selected, even if the compiling was not complete, it
will re-compile.
Error and warning messagswill be here.
Visual C++ (v6)Visual C++ (v6)
Program output and interface at DOS prompt.
Visual C++ (v6)Visual C++ (v6)
Open a previously
created project.
Visual C++ (v6)Visual C++ (v6)
Compiler structureCompiler structure
Program generation Program generation stepssteps
Error investigationError investigation
By double clicking on the error message, you can go to the line
containing the error.
There is a variable which is forgotten to be declared before
used.
DebuggingDebugging
Add an integer variable with
name “a”
Linker errorsLinker errors
A function with name “print” is not defined.
The correct one should be printf
Execution errorExecution error
The correct usage of printf for writing
out numbers
DebuggerDebugger
Until now, you should have encountered Until now, you should have encountered programming mistakes. Use debugger:programming mistakes. Use debugger:
Build->set active configuration-> win32 debug
Insert breakpointInsert breakpointChose line Put break point
Start debugging with “F5” or
Build->Start Debug->Go
Debug screenDebug screen
Functions Stack
Variables watching
Current running
line
Debug toolbar
Run line by line by pressing “F10”
or clicking this button
Trace variable values here
Move mouse over the
variable name, and see the
current values
To execute and skip to the next
breakpoint, press “F5”