C/C++ Compiling.

Slides:



Advertisements
Similar presentations
C++ Introduction.
Advertisements

Introduction to C++ Programming. Brief Facts About C++ Evolved from C Designed and implemented by Bjarne Stroustrup at the Bell Labs in the early 1980s.
EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline History of C and C++ C++ Standard Library Object Technology Basics.
Writing and Testing Programs Drivers and Stubs Supplement to text.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation Namespaces Simple Make Files (Ignore all class references.
Three types of computer languages
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
Computer Science 117 Intro to C++ 08/26/13. Today Discuss Syllabus Brief History of C++ How to Execute a C++ program. Reading assignment.
 2003 Prentice Hall, Inc. All rights reserved. 1 Machine Languages, Assembly Languages, and High-level Languages Three types of computer languages 1.Machine.
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
C++ fundamentals.
A Brief History of C++ A Brief History of C++ In the early 1970s, Dennis Ritchie of Bell Laboratories was engaged in a project to develop a new operating.
Introduction to C. A Brief History Created by Dennis Ritchie at AT&T Labs in 1972 Originally created to design and support the Unix operating system.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
1 C/C++ Compiling. 2 Outline Surfing websitewww.mcsr.olemiss.edu Logging into the system via ssh Brief History of C/C++ languages.
1 C/C++ UM/MCSR Last modified: September 3, 2008.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
COMPUTER PROGRAMMING. Introduction to C++ History Merges notions from Smalltalk and notions from C The class concept was borrowed from Simular67 Developed.
COMPUTER SCIENCE I C++ INTRODUCTION
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
Intro. to Game Programming Want to program a game?
Introduction to C Programming. A Brief History u Created by Dennis Ritchie at AT&T Labs in 1972 u Originally created to design and support the Unix operating.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
COMPSCI 174- Introduction to C++ Class hour Section 01: MWF 9:55am – 10:45am. Hyer Hall 210.
Instructor: Tina Tian. About me Office: RLC 203A Office Hours: Wednesday 1:30 - 4:30 PM or .
1 C/C++ UM/MCSR. 2 Logging into the system using ssh Logging into the system from Windows: –Start the secure shell client: Start->Programs->SSH.
History of C and C++ C++ evolved from C ANSI C C++ “spruces up” C
Separate Compilation. A key concept in programming  Two kinds of languages, compilation (C, Pascal, …) and interpretation (Lisp, …, Matlab, Phython,
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice:
Creating your first C++ program
Programming With C.
Introduction to C++ Programming Language
Multiple Files. Monolithic vs Modular  one file before  system includes  main driver function  prototypes  function.
Course Title: Introduction to C++ Course Instructor: ADEEL ANJUM Chapter No: 01 1 BY ADEEL ANJUM (MCS, CCNA,WEB DEVELOPER)
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
N from what language did C++ originate? n what’s input, output device? n what’s main memory, memory location, memory address? n what’s a program, data?
C ++ Basics by Bindra Shrestha sce.uhcl.edu/shresthab CSCI 3333 Data Structures.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C CMSC 104, Section 4 Richard Chang 1.
12/18/2015 CSI Chapter 1 1 Compiler + Linker = Ready to run code Compiler translates high-level language source code into an intermediate object.
COP 3530 Spring2012 Data Structures & Algorithms Discussion Session Week 2.
Multiple File Compilation and linking By Bhumik Sapara.
Course Title Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
Introduction to C Programming Language. History of C  C was evolved by Dennis Ritchie at AT&T Bell Laboratories in early of 1970s  Successor of: ALGOL.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 2 C++ Basics.
C Programming Lecture 3 : C Introduction 1 Lecture notes : courtesy of Woo Kyun and Chang Byung-Mo.
Week 13 - Friday.  What did we talk about last time?  Server communications on a socket  Function pointers.
1 CS 192 Lecture 4 Winter 2003 December 8-9, 2003 Dr. Shafay Shamail.
KYC - Know your compiler Introduction to GCC
Introduction to C Topics Compilation Using the gcc Compiler
PROGRAMMING WITH C ++.
Introduction to Computers and C++ Programming
LESSON 1 Introduction to Programming Language
Computer Programming Techniques Semester 1, 1998
Separate Compilation and Namespaces
C Language By Sra Sontisirikit
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C Topics Compilation Using the gcc Compiler
Computer science By/ Midhat Mohiey. Introduction to Programming using C ++ 2.
Govt. Polytechnic,Dhangar
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
Principles of object – oriented programming UNIT-1 Chapter-1.
Functions Imran Rashid CTO at ManiWeber Technologies.
Introduction to C Topics Compilation Using the gcc Compiler
SPL – PS1 Introduction to C++.
Presentation transcript:

C/C++ Compiling

A Brief History of C language In the early 1970s, Dennis Ritchie of Bell Laboratories was engaged in a project to develop new operating system. He realized that he needed the use of a programming language that was concise and that produced compact and speedy programs. This need led Ritchie to develop the programming language called C.

A Brief History of C++ In the early 1980's, also at Bell Laboratories, another programming language was created which was based upon the C language. This new language was developed by Bjarne Stroustrup and was called C++. According to Stroustrup, the purpose of C++ is to make writing good programs easier and more pleasant for the individual programmer. When he designed C++, he added OOP (Object Oriented Programming) features to C without significantly changing the C component. Thus C++ is a "relative" of C, meaning that any valid C program is also a valid C++ program.

Simple C program // Add two numbers and print the result #include <iostream.h> using namespace std; void main() { int firstNum, secondNum, result; cout<< “Please Enter the first Number”<<endl; cin>> firstNum; cout<< “Please Enter the second Number”<<endl; cin>> secondNum; result= firstNum + secondNum; cout<<firstNum<<“ + “<<secondNum<<“ = “<<result<<endl; }

C/C++ source files suffixes .cpp, .cc, .c suffixes are used for C++ programs that are to be preprocessed, compiled and assembled .c for C programs that are to be processed, compiled and assembled .h or preprocessor (header) files

File Structure Implementation files (.cpp, .cc, .c) Methods are implemented Interface files (.h) Methods and classes are defined Also called header files Implementation files depend on Interface files. Interface holds prototypes and definitions Implementation holds actual code

Compilation Details Source code Assembly Machine Code object.cpp object.s object.o object.h Output main.s main.o main.cpp

Using GNU C Compiler GNU C compiler is one of the compilers installed on willow server (UM research server) GCC is the official compiler of the GNU gcc file1.c command is used to compile and link a C program on willow with the gcc compiler g++ file1.c command is used to compile and link a C++ program on willow with the gcc compiler gcc prog.c command creates an executable file known as a.out

More on gcc command gcc filename [flag] -c -S -E -o newFilename Compile or assemble the source files, but do not link. -S Stop after the stage of compilation proper; do not assemble. -E Stop after the preprocessing stage; do not run the compiler proper. -o newFilename Place output in file newFilename instead of a.out