This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: The g++ -fconserve-space flag
- From: John Love-Jensen <eljay at adobe dot com>
- To: Ferad Zyulkyarov <feradz at gmail dot com>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Tue, 20 Mar 2007 15:15:14 -0500
- Subject: Re: The g++ -fconserve-space flag
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