33
SE 232: C++ Programming in Visual Studio Graphical Development Environments for C++ • Eclipse Widely available open-source debugging environment • Available on Windows, Linux, others Designed to use g++ and other existing open- source tools Unfortunately not working on Urbauer Windows machines Visual Studio Specific to Windows but still widely used • Excellent multi-threaded debugger, eases Windows development Uses Visual C++ (and other tools for other languages) Works fine on Urbauer machines, so we’ll use this for now

Graphical Development Environments for C++

  • Upload
    briar

  • View
    28

  • Download
    1

Embed Size (px)

DESCRIPTION

Graphical Development Environments for C++. Eclipse Widely available open-source debugging environment Available on Windows, Linux, others Designed to use g++ and other existing open-source tools Unfortunately not working on Urbauer Windows machines Visual Studio - PowerPoint PPT Presentation

Citation preview

Page 1: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Graphical Development Environments for C++• Eclipse

– Widely available open-source debugging environment• Available on Windows, Linux, others

– Designed to use g++ and other existing open-source tools– Unfortunately not working on Urbauer Windows machines

• Visual Studio– Specific to Windows but still widely used

• Excellent multi-threaded debugger, eases Windows development– Uses Visual C++ (and other tools for other languages)– Works fine on Urbauer machines, so we’ll use this for now

Page 2: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Overview of Today’s Session• Start Visual Studio and create a C++ project • Look at the code and files it generated automatically• Create a simple “hello, world!” program• Build, fix, and repeat until the program compiles• Set breakpoints and step over lines of the program• Look at the program’s output in the debug terminal• Stepping off the end of the main program

– Into the crtexe.c file from which the main function is called• Try printing out the program’s name (in argv[0])• Look at different syntaxes for the main function

– How those different forms treat argc and argv, for example

Page 3: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Starting Visual Studio

Page 4: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Choosing Visual C++

Page 5: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Click on Create Project

Page 6: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Choose Win32

Page 7: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Fill in Project Name

Page 8: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Click Finish to Create the Project …

Page 9: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

… Which May Take it a While to Do

Page 10: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Visual Studio Generated Several Files

Page 11: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Provided StdAFX Header File

Page 12: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Provided StdAFX Source File

Page 13: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Provided Readme.txt File

Page 14: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Have the Program Print Out Hello, World

Page 15: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Build the Program

Page 16: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

What do the Errors Tell Us We Missed?

Page 17: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Corrected Program

Page 18: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Build Again

Page 19: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Successful Compilation

Page 20: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Setting a New Breakpoint

Page 21: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Breakpoint in the main Function

Page 22: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Start Debugging

Page 23: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Debugger Stops at the Breakpoint

Page 24: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Stepping over the First Line

Page 25: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

After Stepping Over Once

Page 26: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Program Output in Terminal Window

Page 27: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

Stepping Over a Second Time

Page 28: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

At The End of the main Function

Page 29: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

What if we Stepped Over Once More?

Page 30: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

In the crtexe.c file (calls different Mains)

Page 31: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

F5 or Continue to Complete the Run

Page 32: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

All Done (can close crtexe.c now)

Page 33: Graphical Development Environments for C++

CSE 232: C++ Programming in Visual Studio

A Couple More Things to Try• Exercise: what do you see when you have the

program print out argv[0]? – Why does it print that?– What is it printing vs. what we saw in previous sessions?

• Exercise: change syntax of the main function to match what we used in earlier sessions – What does printing argv[0] show now?– What if you print out the other program arguments?