Y
Yuichiro
Hello,
I need your help.
I am trying to use g++ 3.3.2. But I have got a big problem.
Does g++ 3.3.2 support default arguments ?
I wrote a simple c++ source as below.
The compiler returns:
error: default argument given for parameter 3 of `int func(int, int,
int)'
What causes this ?
I am migrating c++ programs written in g++ 2.7.2.3 to g++ 3.3.2.
Some functions containing defaults arguments are used in the programs.
I am at my wit's end.
Any advice would be appreciated.
Thanks in advance.
Yuichiro
default.cc
------------
#include <iostream>
using namespace std;
int func(int a, int b, int n=1);
int main()
{
int t;
t = func(10, 20);
cout << t << endl;
return 0;
}
int func(int a, int b, int n=1)
{
return 100 * n;
}
------------
% g++ default.cc
default.cc: In function `int func(int, int, int)':
default.cc:17: error: default argument given for parameter 3 of `int
func(int, int, int)'
default.cc:4: error: after previous specification in `int func(int,
int, int)'
------------
I need your help.
I am trying to use g++ 3.3.2. But I have got a big problem.
Does g++ 3.3.2 support default arguments ?
I wrote a simple c++ source as below.
The compiler returns:
error: default argument given for parameter 3 of `int func(int, int,
int)'
What causes this ?
I am migrating c++ programs written in g++ 2.7.2.3 to g++ 3.3.2.
Some functions containing defaults arguments are used in the programs.
I am at my wit's end.
Any advice would be appreciated.
Thanks in advance.
Yuichiro
default.cc
------------
#include <iostream>
using namespace std;
int func(int a, int b, int n=1);
int main()
{
int t;
t = func(10, 20);
cout << t << endl;
return 0;
}
int func(int a, int b, int n=1)
{
return 100 * n;
}
------------
% g++ default.cc
default.cc: In function `int func(int, int, int)':
default.cc:17: error: default argument given for parameter 3 of `int
func(int, int, int)'
default.cc:4: error: after previous specification in `int func(int,
int, int)'
------------