CSC 253 Lecture 15.

Slides:



Advertisements
Similar presentations
CSE 303 Lecture 16 Multi-file (larger) programs
Advertisements

Separate compilation Large programs are generally separated into multiple files, e.g. tuples.h, ray.h, ray.c, tuples.c main.c With several files, we can.
1 Chapter Three Using Methods. 2 Objectives Learn how to write methods with no arguments and no return value Learn about implementation hiding and how.
David Notkin Autumn 2009 CSE303 Lecture 20 static make.
Makefiles Tutorial adapted from and myMakeTutorial.txt.
Java Syntax, Java Conventions, CSE 115 Conventions (Part 1) CSE 115 Spring 2006 January 25 & 27, 2006.
Lecture 8  make. Overview: Development process  Creation of source files (.c,.h,.cpp)  Compilation (e.g. *.c  *.o) and linking  Running and testing.
The Preprocessor #include #define N 10 C program Preprocessor Modified C program Preprocessor Object codes.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Introduction to C Programming CE Lecture 7 Compiler options and makefiles.
Subprograms1 THE CALL STATEMENT (chp. 16) Purpose: a calling that executes another program; allows portions of code to be treated as a “black box”. Syntax.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
UNIT 13 Separate Compilation.
Compilation & Linking Computer Organization I 1 November 2009 © McQuain, Feng & Ribbens The Preprocessor When a C compiler is invoked, the.
CCSA 221 Programming in C CHAPTER 15 WORKING WITH LARGER PROGRAMS 1 ALHANOUF ALAMR.
The Make utility. Motivation Small programs all in single cpp file “Not so small” programs : Many lines of code Multiple components More than one programmer.
Separate Compilation make and makefiles
15. WRITING LARGE PROGRAMS. Source Files A program may be divided into any number of source files. Source files have the extension.c by convention. Source.
Makefiles CARYL RAHN. Separate compilation Large programs are generally separated into multiple files, e.g. main.c addmoney.c removemoney.c money.h With.
C code organization CSE 2451 Rong Shi. Topics C code organization Linking Header files Makefiles.
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
Makefiles CSSE 332 Operating Systems
COM S 326X Deep C Programming for the 21st Century Prof. Rozier
Introduction to Computers
CSE 303 Lecture 17 Makefiles reading: Programming in C Ch. 15
Chapter 8: Programming the Microprocessor
Executable program (p1)
MODULAR PROGRAMMING Many programs are too large to be developed by one person. programs are routinely developed by teams of programmers The linker program.
Compilation and Debugging
Compilation and Debugging
Large Program Management: Make; Ant
Makefiles Caryl Rahn.
Linking & Loading.
Functions.
Introduction to Operating System (OS)
CS-3013 Operating Systems C-term 2008
CS1010 Programming Methodology
The Preprocessor Based on Chapter 1 in C++ for Java Programmers by Weiss When a C compiler is invoked, the first thing that happens is that the code is.
CS1010 Programming Methodology
Larger Projects, Object Files, Prototyping, Header Files, Make Files
Large Program Management: Make; Ant
Makefiles and the make utility
More examples How many processes does this piece of code create?
Large Program Management: Make; Ant
CSC 253 Lecture 6.
CSC 253 Lecture 6.
Separating Definition & Implementation
Introduction to C Topics Compilation Using the gcc Compiler
CSC 253 Lecture 7.
CSE 390 Lecture 8 Large Program Management: Make; Ant
Linking & Loading CS-502 Operating Systems
CSC 253 Lecture 14.
Lecture 6: Multiprogramming and Context Switching
Writing Large Programs
Large Program Management: Make; Ant
Introduction to C Topics Compilation Using the gcc Compiler
Large Program Management: Make; Ant
Large Program Management: Make; Ant
Linking & Loading CS-502 Operating Systems
75 previous answer What is of 37.5? ? go to.
Makefiles and the make utility
Compiler vs linker The compiler translates one .c file into a .o file
The Three Attributes of an Identifier
Executable program (p1)
Makefile Assignment Create a file called f1.cpp. It should contain the following function: int squareIt ( int x ) { //insert code to calc and return the.
CSE 390 Lecture 8 Large Program Management: Make; Ant
75 previous answer What is of 60? ? go to.
SPL – PS1 Introduction to C++.
Creating and Using Classes
Large Program Management: Make; Ant
Presentation transcript:

CSC 253 Lecture 15

Multiple Modules Which of the following is not an advantage of using multiple modules? Each programmer can work on different parts of the program at the same time. Each module may contain its own main() function, and whichever one is first on the command line is executed. The dependencies of one module on another are well documented in header files. Object files can be distributed instead of source files, protecting intellectual property.

Naming Conventions Why are naming conventions needed in multi-module programming? So that the names in the header file match those in the .c file. So that one .c file can call functions defined in another .c file. So that the same local variable name can be used in functions in multiple files. So that two programmers do not inadvertently use the same name for externally visible functions.

Object Files and Executables Which of the following is true of files produced with the -c compiler switch? On Unix, they are given the extension .o They can be executed by simply typing their name on a command line. They must be linked with other files before being executed. a and b a and c

Simplifications What happens if we name all three files on the same command line? gcc -o main main.c module1.c module2.c The same thing as if we invoke make without parameters. Same as a, except that no .o files are produced. Compilation error(s) occur. No compilation errors occur, but the program will not run successfully.

Then why use makefiles? In view of the answer to the previous question, why do we need to use makefiles?