30
Using Visual Studio C++ Express Ron Gross [email protected] A current copy of this can be found at http://tinyurl.com/2ucaro or this direct link Last Modified at 06/23/22

Using Visual Studio C++ Express Ron Gross [email protected] A current copy of this can be found at or this direct link

Embed Size (px)

Citation preview

Page 1: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

UsingVisual Studio C++ Express

Ron [email protected]

A current copy of this can be found at http://tinyurl.com/2ucaro or this direct linkLast Modified at 04/21/23

Page 2: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Prerequisite

• Installed Visual Studio (see the separate installation guide on the course website)

Page 3: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Run Lola Run

Page 4: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link
Page 5: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Understanding Projects

• In this course, a Project or Solution is a set of files that will compile into a single executable (.exe) file.

• A project can contain multiple files compiled together. In this course, every project will contain only one .c file (“ex.c”).

• Projects are mandatory even when they contain only one file.

Page 6: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Creating A Project

Page 7: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Project Options

Page 8: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

More Project Options

Page 9: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Clean Up

Page 10: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Adding A File

Page 11: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

File Options

Note the “.c” extension

Page 12: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Common Error

• Solutions:– Find and delete the file on disk– Add Existing Item

Page 13: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Even More Options

Page 14: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Even More Options

Page 15: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Even More Options

Page 16: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Debug/Release

• Don’t play with this, options are different for Debug/Release

Page 17: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Entering A Program

Page 18: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Auto-Completion

• Activated by CTRL-Space

Page 19: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Compiling / Building

Page 20: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Build Errors

Page 21: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Build Errors

Page 22: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Build Warnings

Page 23: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Running

Page 24: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Basic Debugging

• Step Over (F10) – execute a line

• Step Into (F11) – enter a function

• Step Out (Shift-F11) – exit a function

• Continue (Start Debugging) – F5

Page 25: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Debugging Over the Edge

• The compiler warns you when you try to debug “after the end of the program”.

• Just press OK and F5 to finish the run.

Page 26: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Advanced Debugging

• Add/Remove Break Point – F9

• Edit & Continue – allows modification while the program is running.

Page 27: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Watches

• Manual

• Value Modification

• Locals

Page 28: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Opening Existing Solutions

• We open solutions (“foo.sln”) and not the C files directly.

• Either double-click from Explorer or FileOpenProject/Solution

Page 29: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

A Ready Made Solution

• http://www.cs.technion.ac.il/~rgross/CS/template.zip

• Copy into a fresh folder

• Rename all “template” to whatever you want:– In File Names– In File Contents

Page 30: Using Visual Studio C++ Express Ron Gross ron.gross@gmail.com A current copy of this can be found at  or this direct link

Questions?