build not recognising cin>> error C2678: binary '>>' : no operator found which takes a left-hand op

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am using visual express 2010 and when I have trialed vs2010 I am finding there are always issues with the libraries. Can any one pls help. Also- how do I paste this without it becoming 2 miles long?

#include <iostream>
using namespace std;

int main()
{
<span style="white-space:pre int gender();
<span style="white-space:pre
cout<<"Many years ago a baby was born.n";
cout<<"gender:n";
cin>> gender;

if (int gender = 1)
cout<<"A bouncing baby boy.n";
{
<span style="white-space:pre if (int gender=0)
<span style="white-space:pre cout<<"A beautiful baby girl.n";
<span style="white-space:pre else
<span style="white-space:pre cout<<"It was a beast childn";
}

while (int gender=2)

<span style="white-space:pre int beast();
<span style="white-space:pre cout<<"The childbeast grew over time and became :n";
<span style="white-space:pre cout<<"0=foul, 1= vile, 2= violent.n";
<span style="white-space:pre cin>> beast;
<span style="white-space:pre if (int beast=0)
<span style="white-space:pre cout<<"foul; but there was hope for it yet.n";
<span style="white-space:pre {
<span style="white-space:pre if (int beast =1 )
<span style="white-space:pre cout<<"vile.n";
<span style="white-space:pre else
<span style="white-space:pre cout<<"violent ! And was a terror to the village.";
<span style="white-space:pre cout<<"This child beast reigned with fear under it disappeared one day never to return.n";}

<span style="white-space:pre int boy();
<span style="white-space:pre while (int gender =1)
<span style="white-space:pre cout<<"The baby grew and grew into a handsome young man.... until he becamen";
<span style="white-space:pre cout<<"input :0= gay and wore makeup , 1=he suicided, 2= foul.n";
<span style="white-space:pre cin>>boy;
<span style="white-space:pre if (int boy=0)
<span style="white-space:pre cout<<" gay, wore makeup and travelled the country side looking for festivals to dance and party at. He was never heard from again.n";
<span style="white-space:pre {if (int boy=1)
<span style="white-space:pre cout<<"suicidal and he suicided. All the townsfolk were so upset they suicided to and the land was restored to its pristine condition without the human prescence.n";
<span style="white-space:pre else
<span style="white-space:pre return ( beast=0);}
<span style="white-space:pre



return 0;
}



1>------ Rebuild All started: Project: STORY, Configuration: Debug Win32 ------
1>Build started 1/13/2012 3:16:57 PM.
1>InitializeBuildStatus:
1> Touching "DebugSTORY.unsuccessfulbuild".
1>ClCompile:
1> STORY.cpp
1>c:usersyvettedocumentsvisual studio 2010projectsstorystorystory.cpp(10): error C2678: binary >> : no operator found which takes a left-hand operand of type std::istream (or there is no acceptable conversion)
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1053): could be std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&&,signed char *)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1060): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&&,signed char &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1067): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&&,unsigned char *)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1074): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&&,unsigned char &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1097): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&,signed char *)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1104): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&,signed char &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1111): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&,unsigned char *)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1118): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&,unsigned char &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1128): or std::basic_istream<_Elem,_Traits> &std::operator >><char,std::char_traits<char>,int(__cdecl
*)(void)>(std::basic_istream<_Elem,_Traits> &&,_Ty &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ty=int (__cdecl *)(void)
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(179): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_istream<_Elem,_Traits>
&(__cdecl *)(std::basic_istream<_Elem,_Traits> &))
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(185): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_ios<_Elem,_Traits>
&(__cdecl *)(std::basic_ios<_Elem,_Traits> &))
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(192): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::ios_base
&(__cdecl *)(std::ios_base &))
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(199): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::_Bool &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(218): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(short &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(253): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned short
&)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(272): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(int &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(298): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned int &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(316): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(long &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(334): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned long
&)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(354): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(__int64 &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(373): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned __int64
&)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(392): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(float &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(411): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(double &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(429): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(long double &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(447): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(void *&)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(466): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_streambuf<_Elem,_Traits>
*)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> while trying to match the argument list (std::istream, int (__cdecl *)(void))
1>c:usersyvettedocumentsvisual studio 2010projectsstorystorystory.cpp(26): error C2065: beast : undeclared identifier
1>c:usersyvettedocumentsvisual studio 2010projectsstorystorystory.cpp(40): error C2678: binary >> : no operator found which takes a left-hand operand of type std::istream (or there is no acceptable conversion)
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1053): could be std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&&,signed char *)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1060): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&&,signed char &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1067): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&&,unsigned char *)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1074): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&&,unsigned char &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1097): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&,signed char *)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1104): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&,signed char &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1111): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&,unsigned char *)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1118): or std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits>
&,unsigned char &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(1128): or std::basic_istream<_Elem,_Traits> &std::operator >><char,std::char_traits<char>,int(__cdecl
*)(void)>(std::basic_istream<_Elem,_Traits> &&,_Ty &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ty=int (__cdecl *)(void)
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(179): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_istream<_Elem,_Traits>
&(__cdecl *)(std::basic_istream<_Elem,_Traits> &))
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(185): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_ios<_Elem,_Traits>
&(__cdecl *)(std::basic_ios<_Elem,_Traits> &))
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(192): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::ios_base
&(__cdecl *)(std::ios_base &))
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(199): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::_Bool &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(218): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(short &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(253): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned short
&)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(272): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(int &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(298): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned int &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(316): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(long &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(334): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned long
&)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(354): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(__int64 &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(373): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned __int64
&)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(392): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(float &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(411): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(double &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(429): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(long double &)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(447): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(void *&)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludeistream(466): or std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_streambuf<_Elem,_Traits>
*)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> while trying to match the argument list (std::istream, int (__cdecl *)(void))
1>c:usersyvettedocumentsvisual studio 2010projectsstorystorystory.cpp(46): error C2065: beast : undeclared identifier
1> BEAST.cpp
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.32
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

<hr class="sig If (at first you dont succeed) {try, try again…...........;} else {throw the bl@@dy computer out the window !!!}

View the full article
 
Back
Top