ajbharani
July 7th, 2008, 04:07 AM
#include<iostream>
int main()
{
std::string szName;
std::cin >> szName;
std::cout << szName << std::endl;
return 0;
}
This code, while compilation gives the following error.
--------------------Configuration: BasicString - Win32 Debug--------------------
Compiling...
Test.cpp
d:\bharani\programming\c++\basicstring\test.cpp(6) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no ac
ceptable conversion)
d:\bharani\programming\c++\basicstring\test.cpp(7) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no ac
ceptable conversion)
Error executing cl.exe.
Test.obj - 2 error(s), 0 warning(s)
What may be the problem?
Thanks.
int main()
{
std::string szName;
std::cin >> szName;
std::cout << szName << std::endl;
return 0;
}
This code, while compilation gives the following error.
--------------------Configuration: BasicString - Win32 Debug--------------------
Compiling...
Test.cpp
d:\bharani\programming\c++\basicstring\test.cpp(6) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no ac
ceptable conversion)
d:\bharani\programming\c++\basicstring\test.cpp(7) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no ac
ceptable conversion)
Error executing cl.exe.
Test.obj - 2 error(s), 0 warning(s)
What may be the problem?
Thanks.