作业帮 > 综合 > 作业

left of '._Myptr' must have class/struct/union type

来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/05/02 06:40:52
left of '._Myptr' must have class/struct/union type
bool Graphic::IsVerInQue(int id)
{
\x05VerNode* pNode;
\x05vector::iterator it;
\x05for (it = m_aryVerQue_Final.begin(); it = m_aryVerQue_Final.end(); it++)
\x05{
\x05\x05pNode=(VerNode*)it._Myptr;
\x05\x05if(pNode->m_nID == id)
\x05\x05\x05return true;
\x05}
\x05return false;
}
left of '._Myptr' must have class/struct/union type
it是vector::iterator类型,这个类型没有_Myptr这个成员.
或许真的有(比如说你通过源代码看到了),但这个不是给你用的.你要拿到vector里面元素的内容,可以直接用it->m_nID,因为iterator类型重载过箭头运算符
再问: 不好意思,上面少了一个变量定义 VerNode* pNode; VerNode* Myptr; vector::iterator it; 如果按你的方法修改后,查错时是没有错误,但运行时有两个错 LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/graph.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe.
再答: 这不是你这里代码的问题,是你(可能建了可执行项目),但是没有main函数