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: Paul Pluzhnikov
Subject: Re: How to suppress the "multiple definitions of symbol"
Date: Sun, 03 Dec 2006 18:21:27 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

csmgroup@gmail.com writes:

> <<<<<header.inl>>>>
> Hello::Hello(int i_, int j_) { ... }
> void Hello::print() { ... }

> <<<<module>>>>
> #include "header.h"
> #include "header.inl"
...
> And the main program has the same .inl even though it doesn't use the
> class.

In this case, you must declare the methods "inline".

> There are error messages that symbols are duplicated.

That's correct: you didn't make them inline, and you provided 2
separate definitions, hence the error.

> I think there is a g++ flag that can suppress this kind of error.
> Any ideas?

There might be a flag to suppress such errors, but why not write
correct code instead?

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

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