这个函数一直编译不过,如下错误提示。实现的是创建目录的功能。

guguqiaqia 2010-07-20 04:14:08

BOOL CZipImplement::CreatedMultipleDirectory(wchar_t* direct)
{
std::wstring Directoryname = direct;

if (Directoryname[Directoryname.length() - 1] != '\\')
{
Directoryname.append(1, '\\');
}
std::vector<std::wstring> vpath;
std::wstring strtemp;
BOOL bSuccess = FALSE;
for (int i = 0; i < Directoryname.length(); i++)
{
if ( Directoryname[i] != '\\')
{
strtemp.append(1,Directoryname[i]);
}
else
{
vpath.push_back(strtemp);
strtemp.append(1, '\\');
}
}
std::vector::const_iterator vIter;

for (vIter = vpath.begin();vIter != vpath.end(); vIter++)
{
bSuccess = CreateDirectory(vIter->c_str(), NULL) ? TRUE :FALSE;
}

return bSuccess;
}


错误提示是:


Error 2 error C2955: 'std::vector' : use of class template requires template argument list
Error 3 error C2955: 'std::vector' : use of class template requires template argument list
Error 4 error C2133: 'vIter' : unknown size
Error 5 error C2512: 'std::_Vector_const_iterator<_Ty,_Alloc::rebind<_Ty>::other>' : no appropriate default constructor available
Error 6 error C2582: 'operator =' function is unavailable in 'std::_Vector_const_iterator<_Ty,_Alloc::rebind<_Ty>::other>'
Error 7 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_Vector_const_iterator<_Ty,_Alloc::rebind<_Ty>::other>' (or there is no acceptable conversion)
Error 8 error C2678: binary '++' : no operator found which takes a left-hand operand of type 'std::_Vector_const_iterator<_Ty,_Alloc::rebind<_Ty>::other>' (or there is no acceptable conversion)
Error 9 error C2678: binary '->' : no operator found which takes a left-hand operand of type 'std::_Vector_const_iterator<_Ty,_Alloc::rebind<_Ty>::other>' (or there is no acceptable conversion)
Error 10 error C2039: 'c_str' : is not a member of 'std::_Vector_const_iterator<_Ty,_Alloc::rebind<_Ty>::other>'




...全文
41 点赞 收藏 2
写回复
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
iamshuke 2010-07-20
std::vector::const_iterator vIter;
应为std::vector<std::wstring>::const_iterator vIter;
回复
healer_kx 2010-07-20
std::vector<wstring>::const_iterator vIter;
回复
发动态
发帖子
VC/MFC
创建于2007-09-28

1.5w+

社区成员

VC/MFC相关问题讨论
申请成为版主
社区公告
暂无公告