| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1174 人关注过本帖
标题:求教:vs2008中list的使用,在vc++6.0中可以通过,在2008中编译不了
只看楼主 加入收藏
gengning938
Rank: 2
等 级:论坛游民
帖 子:12
专家分:10
注 册:2010-5-13
结帖率:60%
收藏
已结贴  问题点数:17 回复次数:1 
求教:vs2008中list的使用,在vc++6.0中可以通过,在2008中编译不了
如题   list<unsigned int>::iterator itor_space;//定义itor_space;
   
       在使用初始化时编译不了
      CDisagreeDlg::CDisagreeDlg(CWnd* pParent /*=NULL*/)
    : CDialog(CDisagreeDlg::IDD, pParent)
{
    //{{AFX_DATA_INIT(CDisagreeDlg)
        // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
    m_pView = NULL;
    itor_1Lel =NULL;
    itor_space = NULL;//1这个位置出错,信息如下,#define NULL 0
 错误信息:
d:\booleanalign源码和驱动程序\booleanalign_6.1.7\booleanalign\disagreedlg.cpp(30) : error C2679: 二进制“=”: 没有找到接受“int”类型的右操作数的运算符(或没有可接受的转换)
        i:\program files\microsoft visual studio 9.0\vc\include\list(427): 可能是“std::list<_Ty>::_Iterator<_Secure_validation> &std::list<_Ty>::_Iterator<_Secure_validation>::operator =(const std::list<_Ty>::_Iterator<_Secure_validation> &)”
        with
        [
            _Ty=unsigned int,
            _Secure_validation=true
        ]
        试图匹配参数列表“(std::list<_Ty>::_Iterator<_Secure_validation>, int)”时
        with
        [
            _Ty=unsigned int,
            _Secure_validation=true
        ]
}
程序在VC6.0中可以编译,2008中过不去,请教高人如何解决?
搜索更多相关主题的帖子: list 编译 
2010-11-22 14:45
玩出来的代码
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:河南新乡
等 级:贵宾
威 望:11
帖 子:742
专家分:2989
注 册:2009-10-12
收藏
得分:17 
你可根据错误提示打开相应的文件看看,在list文件中有这样的定义typedef _Iterator<_SECURE_VALIDATION_DEFAULT> iterator;而——Iterator又是一个模板类,看他的构造函数有个——Iterator(){}另外几个都是在条件编译下的不一定用到,所以在VC2008中提示没有相应的构造函数,
而在VC6中有这样的构造函数 iterator(_Nodeptr _P): const_iterator(_P) {}其中——Nodeptr是一个指针类型于是itor_space = NULL;会进行隐式类型转化而调用构造函数,

离恨恰如春草,更行更远还生。
2010-11-22 20:02
快速回复:求教:vs2008中list的使用,在vc++6.0中可以通过,在2008中编译不了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014270 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved