The first example shows how to split utility functions off into separate files. It uses these four files. | makefile | package1.cc | tinyutils.h | tinyutils.cc | |
The main program is in package1.cc. It allocates a couple of vectors, does a calculation, prints a vector, and frees the vectors. The functions called by the main program are all defined in tinyutils.cc. The function declarations (which are included by both package1.cc and tinyutils.cc are all in the header file tinyutils.cc. |
[an error occurred while processing this directive] |
[an error occurred while processing this directive] |
[an error occurred while processing this directive] |
[an error occurred while processing this directive] |
This example shows how to use structures too. It performs exactly the same operations as the first example. It uses the same makefile and these three files. | package2.cc | tinyutils2.cc | tinyutils2.h | | The structure is defined in tinyutils2.h. |
[an error occurred while processing this directive] |
[an error occurred while processing this directive] |
[an error occurred while processing this directive] |