非法使用此类型作为表达式- VS 2012
Illegal use of this type as an expression - VS 2012
当编译我的源代码时,我得到了这个错误,'MPageArrayCursor':非法使用这种类型作为表达式在源代码的这一部分:
class MPageArrayCursor {
protected:
int m_nIndex;
public:
MPageArrayCursor(int nIndex) {
m_nIndex = nIndex;
}
virtual ~MPageArrayCursor();
int GetIndex() {
return m_nIndex;
}
void SetIndex(int nIndex) {
m_nIndex = nIndex;
}
};
void Add(T pData, MPageArrayCursor* pCursor=NULL)
{
int nFreeSlot = m_UnusedQueue.top();
m_UnusedQueue.pop();
Set(nFreeSlot, pData, pCursor);
}
最初是一个vc++ 2k10解决方案,我移植到2k12。为什么会出现这个错误?
这是完整的代码:http://pastebin.com/xjVKCZjZ你的代码工作得很好,除了你需要在VS2012上包含std::greater function operator的函数头
#include <functional>
相关文章:
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- (C++)分析树以计算返回错误值的简单算术表达式
- 在VS2010-VS2015下编译时,如何使用decltype作为较大类型表达式的LHS
- 提升精神:解析布尔表达式并简化为规范范式
- 不能在初始值设定项列表中将非常量表达式从类型 'int' 缩小到'unsigned long long'
- 如何为模板化对象创建模板向量?VS正在投掷C3203
- 表达式必须具有类类型 vs.
- C++正则表达式失败(GCC vs Microsoft 编译器)
- 使用函数参数作为常量表达式的一部分 - gcc vs clang
- 在折叠表达式中使用 lambda 时"Uninitialized captured reference"错误 - clang vs gcc
- 缩小从"int"(常量表达式)到"无符号int"的转换 - MSVC vs gc
- 数学表达式到x86汇编Unsigned vs Unsigned
- 表达式在C++VS中未计算为常量
- 什么是优先!表达式!x——中的运算符vs——
- 提振.正则表达式vs c++ 11正则表达式
- 如何读取这些表达式:*&指针VS &*指针
- 无法在VS 14 CTP中使用auto声明lambda:类型为'void'的条件表达式是非法的
- 正则表达式( "(abc|aa.*|bb.*)" ) vs 正则表达式( "(aa.*|bb.*|cc.*)" );
- 正则表达式:提升::Xpressive vs 提升::正则表达式
- 非法使用此类型作为表达式- VS 2012