#pragma interface and #pragma implementation
Giovanni Bajo
giovannibajo@libero.it
Wed Jun 2 09:06:00 GMT 2004
Steven T. Hatton wrote:
> I don't claim to understand why it happens, but I have encountered
> many circumstances in which moving an implementation of a function
> out of a header and into a source file eliminated errors saying thing
> had been defined multiple times.
Of course. To keep a function in a header file, you must ensure your function
has internal linkage by making it inline or static (or within an anonymous
namespace, etc.). If it is a member function, you can make it inline
explicitly, or implicitly (by defining it within the class definition).
Giovanni Bajo
More information about the Gcc
mailing list