This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: function signature different in .o file!
- To: amehrotr at mail dot icims dot csl dot uiuc dot edu, gcc-bugs at gcc dot gnu dot org
- Subject: Re: function signature different in .o file!
- From: Mike Stump <mrs at windriver dot com>
- Date: Mon, 24 Jan 2000 16:37:56 -0800 (PST)
> Date: Mon, 24 Jan 2000 18:31:50 -0600
> From: Amit Mehrotra <amehrotr@mail.icims.csl.uiuc.edu>
> I think this is a bug in g++. I have a function called
> setCurrentControlledSourceControllingBranchCurrent ( /* some definition
> */)
> I do a forward declaration of that, use it and later define it (all in
> the same .cc file). The file compiles without an error but at link time,
> ld says that the function is undefined. I did an nm on the .o file and
> grepped for this functions and I find the signatures of the two
> instances of this functions are different. Here are two signatures:
> If the signatures of the definition and the point of use were indeed
> different (they are not in my .cc code), the .cc file should not have
> compiled in the first place!
Not a bug.
The difference is a const. You wind up with two completely different
functions. You only defined one of them.
func (T const &, Y)
func (T &, Y)
Please add the missing const (or remove it from the other. c++filt
will explain this problem to you.