Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

default argument given for parameter error

60 views
Skip to first unread message

zwei100...@gmail.com

unread,
Oct 3, 2014, 6:47:40 PM10/3/14
to
I get this error even though i have the default argument only in the header file , as it should be.
Googling i found that puting the def. value both in the header AND the implementation file is what's usually causing this error.

I hope i wake up to a solution.... thank you

Ian Collins

unread,
Oct 3, 2014, 6:51:02 PM10/3/14
to
What error?

Post the code and the error message.

--
Ian Collins

Ronald

unread,
Oct 3, 2014, 8:35:56 PM10/3/14
to
Probably you have something like
class C
{
public :
void foo(int I = 0);
};

void C::foo(int I = 0)
{}

and it chokes on the second I = 0

If so, remove the = 0

If that is not your problem, post code.

rlc

me

unread,
Nov 24, 2014, 9:09:44 PM11/24/14
to
Default argument values go in the function declaration, not in the
implementation. That's just the way it is. Might have something to do
with the header file being where people look to see how a function is
declared. Makes sense to put default argument values there.

Robert Wessel

unread,
Nov 25, 2014, 1:53:15 AM11/25/14
to
Well, it needs to be in the declaration, since the compiler needs it
to compile a call with a default parameter (and it may well not be
able to see the implementation at the time of the call's compilation).
0 new messages