1.这是怎么回事,在另一个project里就无问题,难道又差了什么头文件?已经#include "iostream.h" 了
string strMyService ="0123456789";
for (i=0;i<10;i++)
strMyService[i]=buf[i]; //获得 标识字符串
if (strMyService != "MyService1") return false; //如果不正确 就退出
error C2678: binary '!=' : no operator defined which takes a left-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion)error C2872:binary '<<' : no operator defined which takes a left-hand operand of type 'class ostream_withassign' (or there is no acceptable conversion)error C2872: 'cout' : ambiguous symbol共3个错误
string strMyService ="0123456789";
for (i=0;i<10;i++)
strMyService[i]=buf[i]; //获得 标识字符串
if (strMyService != "MyService1") return false; //如果不正确 就退出
error C2678: binary '!=' : no operator defined which takes a left-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion)error C2872:binary '<<' : no operator defined which takes a left-hand operand of type 'class ostream_withassign' (or there is no acceptable conversion)error C2872: 'cout' : ambiguous symbol共3个错误
using namespace std;
2、iostream.h是为了兼容c语言而保留的,这里面不包含对C++扩展的支持,比如不支持string类型
2。error C2872:你可能直接引用的其他类的成员
解决了 != cout 的问题还剩
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 acceptable c
onversion)
这里的问题
return false;
不可以吗?
这个 -> 符号的问题
ConnectThread.obj : error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CConnectThread::GetRuntimeClass(void)const " (?GetRuntimeClass@CConnectThread@@UBEPAUCRuntimeClass@@XZ)
Debug/MServer.exe : fatal error LNK1120: 2 unresolved externals