整理: STL相关的编译错误
来源:互联网 发布:excel工作表数据保护 编辑:程序博客网 时间:2024/06/05 20:02
"error C2039: 'wstring' : is not a member of 'stlp_std'", 开发环境为: vs2005 + STLport-5.2.1 + unicode + winxpSp3
解决方法: #include <string>
<2011_1003>
STL使用结构时, 出现 error C2678 错误.
解决方法是重载操作符 ==, 而且要用在操作符定义后加 const 修饰
/*** @file testlist.cpp* stl's version is 5.2.1*/#include "stdafx.h"#include <windows.h>#include <list>#pragma pack(1)typedef struct _tag_UserInfo{ union { BYTE ucReserve[1024]; struct { INT iUserId; }; }; /** * error C2678: * :\stlport-5.2.1\stlport\stl\_list.h(640) : error C2678: binary '==' : * no operator found which takes a left-hand operand of type 'const _tag_UserInfo' * (or there is no acceptable conversion) */ //BOOL _tag_UserInfo::operator==(const _tag_UserInfo & param) /**< error */ BOOL _tag_UserInfo::operator==(const _tag_UserInfo & param) const /**< ok */ { return (this->iUserId == param.iUserId) ? TRUE : FALSE; }}TAG_USERINFO;#pragma pack()INT _tmain(INT argc, _TCHAR* argv[]){ TAG_USERINFO User; std::list<TAG_USERINFO> myIntList; ZeroMemory(&User, sizeof(TAG_USERINFO)); User.iUserId = 1; myIntList.insert(myIntList.begin(), User); myIntList.remove(User);/**< 需要重载 == 操作符, 否则出现 error C2678 错误 */ return 0;}
- 整理: STL相关的编译错误
- android 编译STL模块相关错误解决
- android 编译STL模块相关错误解决
- STL map相关学习整理
- VC++编译错误整理
- PB编译错误整理
- 编译错误整理
- 编译错误整理
- gcc编译错误整理
- xcode 编译错误整理
- 编译错误整理
- log4cpp编译错误整理
- IAR编译错误整理
- Android_Ant 编译相关资料整理
- dos中与java编译运行相关的常用命令整理
- apk反编译、回编译相关工具的使用整理
- maven错误相关(整理中)
- linux 编译C++错误整理
- 代理:JVM自动生成.class文件 等到.class的构造函数和成员方法
- sap CR导入请求提示文件打不开
- 与整数相关的命令
- 等答案
- JVM学习笔记(一)------基本结构
- 整理: STL相关的编译错误
- 初识C++标准模板库STL
- Java网络编程
- JVM学习笔记(二)------Java代码编译和执行的整个过程
- Android 开发中使用 SQLite 数据库
- JAVA的链表实现
- linux驱动之按键中断
- File already exists: filesystem '/path/db', transaction svn常见错误
- C++ map 模板