This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: C++ static member function reported as undefined references by linker?
- From: corey taylor <corey dot taylor at gmail dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: David Cespedes <David dot Cespedes at i-o dot com>, gcc-help at gcc dot gnu dot org
- Date: Sat, 5 Nov 2005 15:23:49 -0600
- Subject: Re: C++ static member function reported as undefined references by linker?
- References: <764B61E47816BC47B59D1A8B15DF01070C0480@digiexch02.iodigi.ioroot.tld> <436D1C22.90709@codesourcery.com>
He was trying to use an old gcc version to compile some code that had
a global namespace declared class and static class method.
The issue was that the static class method wasn't given external
linkage in that version without declaring the class in a named
namespace.
For about a day, I mistakenly said it was appropriate behavior because
the class wasn't declared in a proper namespace, but after coming to
my senses and the spec, it clearly should have external linkage now
(2003 spec).
I gave him the work-a-round for that old gcc to simply declare the
class inside of a named namespace instead of global namespace.
corey
On 11/5/05, Nathan Sidwell <nathan@codesourcery.com> wrote:
> David Cespedes wrote:
> > Can you help with this issue, in regards to C++ static member functions and why they are reported as undefined references by the linker?
> >
> > Please see attached email trail!
>
> please provide a complete test case, I can't figure out from the email trail
> what you;re trying to compile.
>
> nathan
>
> --
> Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
> nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
>
>