C++ Programming In Visual Studio

  • Uploaded by: muthu26219897884
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View C++ Programming In Visual Studio as PDF for free.

More details

  • Words: 629
  • Pages: 33
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

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

CSE 232: C++ Programming in Visual Studio

Starting Visual Studio

CSE 232: C++ Programming in Visual Studio

Choosing Visual C++

CSE 232: C++ Programming in Visual Studio

Click on Create Project

CSE 232: C++ Programming in Visual Studio

Choose Win32

CSE 232: C++ Programming in Visual Studio

Fill in Project Name

CSE 232: C++ Programming in Visual Studio

Click Finish to Create the Project …

CSE 232: C++ Programming in Visual Studio

… Which May Take it a While to Do

CSE 232: C++ Programming in Visual Studio

Visual Studio Generated Several Files

CSE 232: C++ Programming in Visual Studio

Provided StdAFX Header File

CSE 232: C++ Programming in Visual Studio

Provided StdAFX Source File

CSE 232: C++ Programming in Visual Studio

Provided Readme.txt File

CSE 232: C++ Programming in Visual Studio

Have the Program Print Out Hello, World

CSE 232: C++ Programming in Visual Studio

Build the Program

CSE 232: C++ Programming in Visual Studio

What do the Errors Tell Us We Missed?

CSE 232: C++ Programming in Visual Studio

Corrected Program

CSE 232: C++ Programming in Visual Studio

Build Again

CSE 232: C++ Programming in Visual Studio

Successful Compilation

CSE 232: C++ Programming in Visual Studio

Setting a New Breakpoint

CSE 232: C++ Programming in Visual Studio

Breakpoint in the main Function

CSE 232: C++ Programming in Visual Studio

Start Debugging

CSE 232: C++ Programming in Visual Studio

Debugger Stops at the Breakpoint

CSE 232: C++ Programming in Visual Studio

Stepping over the First Line

CSE 232: C++ Programming in Visual Studio

After Stepping Over Once

CSE 232: C++ Programming in Visual Studio

Program Output in Terminal Window

CSE 232: C++ Programming in Visual Studio

Stepping Over a Second Time

CSE 232: C++ Programming in Visual Studio

At The End of the main Function

CSE 232: C++ Programming in Visual Studio

What if we Stepped Over Once More?

CSE 232: C++ Programming in Visual Studio

In the crtexe.c file (calls different Mains)

CSE 232: C++ Programming in Visual Studio

F5 or Continue to Complete the Run

CSE 232: C++ Programming in Visual Studio

All Done (can close crtexe.c now)

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?

CSE 232: C++ Programming in Visual Studio

Related Documents


More Documents from ""

Vc++tutorial
November 2019 11