help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to suppress the "multiple definitions of symbol"


From: Ulrich Eckhardt
Subject: Re: How to suppress the "multiple definitions of symbol"
Date: Tue, 05 Dec 2006 22:40:49 +0100
User-agent: KNode/0.10.4

abhinav.lele@gmail.com wrote:
> why dont u try something like this
> this is done with all headers
> 
> #ifndef __HEADER_IDENTIFIER__
> #define __HEADER_IDENTIFIER__

First thing here: you are not allowed to use names with two consecutive
underscores. Further, to bar that question, names beginning with an
underscore and a capital letter are also reserved.

> #include <iostream>
> 
> // class definitions
> //function definitions
> 
> 
> #endif
> 
> This would automatically take care of duplicacy.

No it doesn't. This only works against multiple inclusion into a single
translation unit (typically one .cpp file). In the next TU those macros
are again undefined and the code will be included again.

[fullquote snipped]

Uli

-- 
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]