Re: [Dev-C++] function name conflict
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2007-03-08 13:38:33
|
Nothing wrong with using constructors as in:
string a(x);
string b(y);
Your code will build correctly, if you write:
string s3 =3D ::plus(s1,s2);
You problems is that you got into troubles with the backwards-compatible
work-around:
using std::plus;
in the gcc header files, and needed to specify that you wanted to use your
implementation of plus, and not the implementation already available in
the std namespace.
/pwm
On Thu, 8 Mar 2007, DC A wrote:
> Britsch, Matthias wrote:
> >I have never seen such a use of the string constructor.
> >Try string a =3D x; and string b =3D y; instead. (You have declared x an=
d y
> >already in the function header).
> >
> >
>
> Thanks for your reply. okay I changed the plus function Now it looks like
> this:
>
> string plus(string x, string y)
> {
> string a =3D x;
> string b =3D y;
>
> string c =3D a + b;
>
> return c;
> }
>
> But still getting the error:
>
> /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_=
function.h:
> In function =91int main()=92:
> /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_=
function.h:134:
> error: =91template<class _Tp> struct std::plus=92 is not a function,
> test.cc:7: error: conflict with =91std::string plus(std::string,
> std::string)=92
> test.cc:21: error: in call to =91plus=92
>
> _________________________________________________________________
> Your Space. Your Friends. Your Stories. Share your world with Windows Liv=
e
> Spaces. http://spaces.live.com/?mkt=3Den-ca
>
>
>
|