29
Our Environment Our Environment We will exercise on We will exercise on Microsoft Visual C++ Microsoft Visual C++ v.6 v.6 because that is what we have because that is what we have in the univ. in the univ. but there are many free but there are many free compilers, too. compilers, too.

Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Embed Size (px)

Citation preview

Page 1: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

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.

Page 2: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Page 3: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

New.. Ctrl+N

Page 4: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Choose: “Win32 Console Application”

Project and file directory

project title(name of .exe)

Page 5: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Page 6: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

New source file will be included in the project

Page 7: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Choose: “c++ source file”

Give a file name with

extension .c

Page 8: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Write your program here

Page 9: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Compile the C file

Page 10: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Build an executable (.exe)

file.

Page 11: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

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.

Page 12: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Program output and interface at DOS prompt.

Page 13: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Open a previously

created project.

Page 14: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Visual C++ (v6)Visual C++ (v6)

Page 15: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Compiler structureCompiler structure

Page 16: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Program generation Program generation stepssteps

Page 17: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

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.

Page 18: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

DebuggingDebugging

Add an integer variable with

name “a”

Page 19: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Linker errorsLinker errors

A function with name “print” is not defined.

Page 20: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

The correct one should be printf

Page 21: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Execution errorExecution error

Page 22: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

The correct usage of printf for writing

out numbers

Page 23: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

DebuggerDebugger

Page 24: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

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

Page 25: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Insert breakpointInsert breakpointChose line Put break point

Start debugging with “F5” or

Build->Start Debug->Go

Page 26: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Debug screenDebug screen

Functions Stack

Variables watching

Current running

line

Debug toolbar

Page 27: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Run line by line by pressing “F10”

or clicking this button

Trace variable values here

Page 28: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

Move mouse over the

variable name, and see the

current values

Page 29: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because

To execute and skip to the next

breakpoint, press “F5”