cs31 lecture 17

X the same header can be included multiple times the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: plementing the functions to be used The prototype of the functions to be used Adding some options to the compiler about the location of those 2 Adding items items 66 Creating a library x In a nutshell, a library is a set of functions (no ‘main()
’ In function)
 x When creating a library, a collection of .cpp and .hh files When are created by the developer are x Each file can be compiled as a stand-alone unit (-c option Each in GCC)
 to get object code in x The object code files are then packed into a single archive x The developer ships archive + headers, and/or source + The headers headers 67 A few observations x If the prototype is missing, the compiler yields a warning If (not an error)
 with many compilers (not The missing prototype may be “replaced” with dummy int return The type and arguments type x If the function is used before the header is included, then If the above error arise (same as missing header)
 the x Multiple headers may define the same function: be careful! x The same header can be included multiple times The (recommend to correctly protect it)
 (recommend 68 Namespace x Namespaces roughly groups together functions under a Namespaces common name prefix common x Good programming habit: use a specific namespace for a Good library library x Be careful: multiple different namespaces can define the Be same function same 69 More on namespaces x Syntax for declaring a namespace and functions in it: namespace <name> { [fun...
View Full Document

This note was uploaded on 04/03/2014 for the course CS 31 taught by Professor Melkanoff during the Fall '00 term at UCLA.

Ask a homework question - tutors are online