This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: #pragma interface and #pragma implementation


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]