CPS120: Introduction to Computer Science Compiling Your Programs Using Visual C++

Slides:



Advertisements
Similar presentations
Getting started with MPLAB Launch MPLAB Set Toolbar as in the next slide by clicking the leftmost icon Open a new Source file by choosing [FILE][NEW] Type.
Advertisements

CS 450 MPX P ROJECT Introduction to Turbo C. W HY USE T URBO C? Many ANSI C compilers are available for free, however they lack certain features that.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Introduction to Windows File Management
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
The Windows Registry Adapted from
1 Lab Session-I CSIT120 Spring2001 Using Windows Using An Editor Using Visual C++ Using Compiler Writing and Running Programs Lab-1 continues (Session.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Course Introduction and Getting Started with C 1 USF - COP C for Engineers Summer 2008.
Here’s how to start the Microsoft Visual C++ program; click on start, then programsclick on start, then programs Choose Microsoft Visual C++ or Microsoft.
Key Applications Module Lesson 12 — Word Essentials
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
How to Use The Borland C++ Compiler Version 5
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Macros and VBA A macro is a set of instructions that tells Excel which commands to execute.
Chapter 2 Software Tools and Assembly Language Syntax.
Introduction to VB.NET Tonga Institute of Higher Education.
Hello World In C++ and Microsoft Visual C++. Directions to begin a project 1. Go to All Programs 2. Open Visual Studio C++ 3. Click on New Project 4.
The NetBeans IDE CSIS 3701: Advanced Object Oriented Programming.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
Pasewark & Pasewark 1 Word Lesson 1 Word Basics Microsoft Office 2007: Introductory.
MICROSOFT WORD GETTING STARTED WITH WORD. CONTENTS 1.STARTING THE PROGRAMSTARTING THE PROGRAM 2.BASIC TEXT EDITINGBASIC TEXT EDITING 3.SAVING A DOCUMENTSAVING.
Copyright © 2012 Pearson Education, Inc. Chapter 1 Introduction to Computing and Programming.
1 2 Lab 2: Organizing Your Work. 2 Competencies 3 After completing this lab, you will know how to: 1. Use Explorer to manage files. 2. Copy files. 3.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
A First Look At Microsoft Visual Basic Lesson 1. What is Microsoft Visual Basic? Microsoft Visual Basic is a software development tool, which means it.
A1 Visual C++.NET Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 1 Quick Introduction The following.
File Management Presented to The Glades Computer Club January 4, 2001.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
Active-HDL Interfaces Debugging C Code Course 10.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Hello World in the Forte IDE An introduction to the Forte IDE (integrated development environment) writing the classic “Hello World” program in Java.
RIGHT Mouse Button Formatting Cut Copy Paste Save LEFT Mouse Button MAIN BUTTON Single clicks Double clicks Drag Highlight.
Using Microsoft Visual Studio 2005 Original by Suma Rao Revised by John G. McMahon ( 9/6/2008 )
XP New Perspectives on Windows 2000 Professional Windows 2000 Tutorial 2 1 Microsoft Windows 2000 Professional Tutorial 2 – Working With Files.
CPS120: Introduction to Computer Science Compiling Your First Program.
Using Microsoft Visual Studio C++ Express 2005 Name: Dr Ju Wang Ashwin Belle Course Resource:
Getting Started with Word & Saving Guided Lesson.
CPS120: Introduction to Computer Science Introduction to C++
CPS120: Introduction to Computer Science Compiling Your First Program.
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
© I-Logix Rhapsody C++ V /01/2004E1-1 “Essential” Tool Training Basic Rhapsody Basic Rhapsody Rhapsody in C++ V /01/04.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
XP New Perspectives on Microsoft Windows XP Tutorial 2 1 Microsoft Windows XP Working with Files Tutorial 2.
Access Module Implementing a Database with Microsoft Access A Great Module on Your CD.
Microsoft Office 2007: Introductory Pasewark & Pasewark 1.
The Debugging Process Syntax Errors CPS120 Introduction to Computer Science Lecture 4.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
1 1 1 Introduction to Java. 2 History of Java Java – Originally for intelligent consumer-electronic devices – Then used for creating Web pages with dynamic.
Today We Will Review: Operating Systems (Windows) (week 3 & 4) Starting up MS Windows Desktop and its contents Functions of the desktop components Brain.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Key Applications Module Lesson 12 — Word Essentials Computer Literacy BASICS.
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
Fundamentals of Windows Mouse n 4 Basic Operations: –Pointing –Clicking –Double Clicking –Dragging.
Excel Tutorial 8 Developing an Excel Application
Word Lesson 1 Word Basics
Chapter 2: The Visual Studio .NET Development Environment
Chapter 1: An Introduction to Visual Basic 2015
Introduction to Programming
Introduction to Programming
Download and Installation of code::blocks
An Introduction to Debugging
Running a Java Program using Blue Jay.
Presentation transcript:

CPS120: Introduction to Computer Science Compiling Your Programs Using Visual C++

Compilers Engines that work on your behalf to process instructions and allow you to deal with various basic rules of the language –The compiler’s job is to make sure you follow the rules, to require that you provide enough information that the compiler can translate you instructions into languages the components can understand

Compilers Available Products range from freeware compilers to work environments designed for commercial application development –Borland C++ compiler –CodeWarrior –IBM Visual Age C++ –Microsoft Visual C++ –GNU freeware –DJGPP freeware ( )

Compilation Process 1.Get the set of instructions from you 2.Review the instructions to see if they violate the rules (syntax) of the language 3.If all the rules are obeyed, create a working file in the language of the computer (machine language) 4.Attach to the working file full instructions for any shortcuts you may have used (linkage) 5.Assemble a final file in machine language

Compiler Files Source code Linked/Library file Object file Executable file

Source Code The set of instruction that you will develop on your own for processing by the compiler

Executable Files A machine-language executable file created when the compilation process is complete –All that is needed to run the program –Not human-readable –Has the extension.EXE –Stored in binary form Copies may be distributed (portable) –Known as an application

Compiling and Debugging Executable code will not be created until you correct all of the syntax errors in your source code Then the fun (with logic errors) begins

Creating Source Code Files Actually Compiling a Program

Creating Source Code Programmers spend most of their time with source code files –Need to be comfortable with an editor that creates ASCII text files 7-bit representation of all keyboard character –Don’t use a word processor –If an editor in an environment is available, use that, it provides more sophisticated tools

Using the Editor Save often because there is no autosave in Visual C++ The editor will do matching of delimiters and intelligent indentation

Columns and White Space Modern programming languages are free form with delimiters instead of columns to determine the end of instructions –The ; (semi-colon) is the delimiter used in C++ Use tabs, indents, and blank lines in any manner that makes code easier to understand Many programming instructions become subordinate to other instructions due to scope and other restrictions. Formatting code to reflect this makes it easier to read

Color Coding in Visual C++ Editor Comments are green and are ignored by the compiler All ANSI keywords are coded in blue Other code is in plain black –Compiler keywords like cin and cout are also shown in black

Setting Up a Visual C++ Workspace 1.Left-click START 2.In the program section, select Visual Studio or Visual C++ (depending on what is installed) 3.Left click on the Visual C++ icon to load the environment 4.Create a new work area by choosing FILE/NEW 5.Choose FILES tab 6.Click on the C++ Source File to reach the editor i.Add a filename and directory before continuing e.g. c:/cppFun/myFirstCpp

Setting Up a Visual C++ Workspace 7.Create the directory with START / EXPLORE 8.Double-click the drive letter 9.Choose FILE, NEW FOLDER 10.Left click on FOLDER 11.Change new folder to cppFUN 12.Close Explorer with the X 13.Back in Visual C++, type myFirstCpp in the file box 14.Click OK and get back to the main edit screen

Setting Up a Visual C++ Workspace 15.Enter the source code 16.After entering the program, FILE then SAVE

Why Create New Subdirectories? You should always use subdirectories to store your files. Visual C++ creates quire a few work files when it generates the executable file for you source code, and they will be easy to dispose of if you keep everything together in one convenient place. Under no circumstances should you use the root (C:\) directory except on a floppy disk (A:\).

Running the Program 1.Press the REBUILD ALL button. It has two arrows in a box 2.Press the RUN button. It is a red exclamation point

Disk Space Issues Text files are insignificant in terms of space However, six other files are created every time something is compiled; some get around 95% full –Highlighting the disk in are 3 or 4 times larger than the source –You can delete anything but the file with the.cpp suffix; everything else can be recreated

Recompiling 1.Open the file by going the file you stored it in and double clicking on it 2.Scan the source code for obvious errors before attempting to compile 3.Attempt to compile using the COMPILE button or choosing the first option on the BUILD menu 4.Answer Yes to use the default project workspace –The lower window will be active and the compile will occur 5.Note the number of errors and warnings –These need to be dealt with before executable code is created