The g++ -fconserve-space flag
Ferad Zyulkyarov
feradz@gmail.com
Wed Mar 21 04:14:00 GMT 2007
Thanks John,
Your answer helped me to understand what the actual problem is.
On 3/20/07, John Love-Jensen <eljay@adobe.com> wrote:
> Hi Ferad,
>
> Sounds like you have header files that are defining symbols, when what you
> want is for the header files to declare them (not define them).
>
> Take a look at Stroustrup's C++ Programming Language (special edition, or
> third edition) section B.2.2 "C Code That Is Not C++".
>
> This is valid C, but not valid C++:
> int foo;
> int foo;
>
> In C, only one foo is defined.
>
> In C++, the second foo causes an error in the translation unit. (And if the
> int foo is in different translation units, it causes an error at link time.
> Violation of ODR.)
>
> In C++, you may need to do this in your header files:
>
> extern int foo; // Declaration, not a definition.
>
> HTH,
> --Eljay
>
>
--
Ferad Zyulkyarov
Barcelona Supercomputing Center
More information about the Gcc-help
mailing list