This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
The g++ -fconserve-space flag
- From: "Ferad Zyulkyarov" <feradz at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 20 Mar 2007 19:53:51 +0100
- Subject: The g++ -fconserve-space flag
Hi,
I want to port an application written in C into C++. When compiling
the code with the C compiler (gcc) some of the variables are compiled
as common symbols that the linker treats without problems. But when I
compile the code with g++ these common symbols are put in BSS section
and at link time, the linker reports for multiple definitions of the
same variable in different object files.
Before writing here, I looked for some solution and as I understand
the -fconserve-space flag is supposed to solve my problem. There is
another posting in the mail grup that relates to -fconserve-space flag
that it doesn't have any effect
(http://gcc.gnu.org/ml/gcc-help/2004-08/threads.html#00008). The
suggested solutions are to define the variables that cause the problem
as either static or extern. Static definition changes the
logic/semantics of the application, whereas the extern declaration
will involve a lot of code refactoring :(
I would welcome all the comments that would save me the huge burden of
code rewriting.
Thanks,
Ferad
--
Ferad Zyulkyarov
Barcelona Supercomputing Center