类没有成员错误 [英] Class Has No Member Error

查看:81
本文介绍了类没有成员错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此代码上出错....是否需要添加一些内容以获取第三行以返回文件大小?

I''m getting an error on this code....do I need to add something to get the third line to return file size?

for(std::map<std::wstring,>::const_iterator it = map.begin(); 
        it != map.end(); ++it) 
    { 
        MessageBoxW(NULL,it->first.c_str(),L"File Name",MB_OK); 
        MessageBoxW(NULL,it->second.sLastAccessTime.c_str(),L"File Date",MB_OK);
	MessageBoxW(NULL,it->third.nFileSize.c_str(),L"File Size",MB_OK); 
    } 



错误:1 IntelliSense:类"std :: pair"没有成员"third"



The Error: 1 IntelliSense: class "std::pair" has no member "third"

推荐答案

std :: pair是一个模板,具有两个成员,第一个和第二个,没有第三"成员.

假设nFileSize是std :: string second.nFileSize.c_str()可能会达到您的期望.

最好的问候
Espen Harlinn
std::pair is a template with two members, first and second, there is no "third" member.

Assuming that nFileSize is a std::string second.nFileSize.c_str() will probably do what you expect.

Best regards
Espen Harlinn


这篇关于类没有成员错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆