Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 253 Lecture 15.

Similar presentations


Presentation on theme: "CSC 253 Lecture 15."— Presentation transcript:

1 CSC 253 Lecture 15

2 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.

3 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.

4 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

5 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.

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


Download ppt "CSC 253 Lecture 15."

Similar presentations


Ads by Google