bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ld bug!


From: Nick Clifton
Subject: Re: ld bug!
Date: 08 Oct 2002 09:38:22 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

Hi Blues,

> As above shown, these 2 source files both define a variable qq, it
> should cause the bug of multiply-defined symbols while linking, but
> it won't!

You do not mention the command line you are using to compile these
source files, nor the host/target that you are compiling on/for.

The cause of your problem however is that the definition of the
variable 'qq' in your second source file:

        char *qq;

is being treated as a "common" definition.  This means that the
definition can be mapped onto same-named definitions in other files,
even if those other definitions are of different sizes.  To avoid this
problem either prepend "extern", if 'qq' is not being defined in this
file:

        extern char * qq;

or else add the -fno-common switch to the gcc command line.

Cheers
        Nick





reply via email to

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