Compilation Errors about Multiple Definitions

Effect

You get compilation errors from symbols being defined multiple times.

Reason

The template instantiation needs to include the type declarations it received as arguments. Your header files containing type declarations used in template classes may automatically be included several times.

Solution

Protect your header files against multiple inclusion by using the following preprocessor macros at the beginning and end of your header files:

#ifndef _MYHEADER_H_
#define _MYHEADER_H_ 1

...

#endif

Where _MYHEADER_H_ is a string, unique to each header file, representing the header file's name.



Introduction to the Collection Classes
Overall Implementation Structure


Possible Implementation Paths
Choosing One of the Provided Implementation Variants
Instantiating the Collection Classes