shared_ptr.hpp(321) : error C2039: 'type_info' : is not a member of 'std' 错误修正

vc++ 6.0使用boost::shared_ptr(boost版本boost_1_33_1)出现以下错误:

f:/c++/boost_1_33_1/boost/shared_ptr.hpp(321) : error C2039: 'type_info' : is not a member of 'std'
        f:/c++/boost_1_33_1/boost/shared_ptr.hpp(342) : see reference to class template instantiation 'boost::shared_ptr' being compiled
f:/c++/boost_1_33_1/boost/shared_ptr.hpp(321) : error C2039: 'type_info' : is not a member of 'std'
        c:/program files/microsoft visual studio/vc98/include/utility(26) : see reference to class template instantiation 'boost::shared_ptr' being compiled
        c:/program files/microsoft visual studio/vc98/include/xtree(28) : see reference to class template instantiation 'std::pair >' being compiled
        c:/program files/microsoft visual studio/vc98/include/map(46) : see reference to class template instantiation 'std::_Tree >,struct std::map,class boost::shared_ptr,struct std::less,class std::allocator > >::_Kfn,struct std::less,class std::allocatorct> > >' being compiled
        f:/vc6/tinyorm/orm/abstractmapper.h(96) : see reference to class template instantiation 'std::map,struct std::less,class std::allocatortentObject> > >' being compiled
PersistentCriteria.cpp
f:/c++/boost_1_33_1/boost/shared_ptr.hpp(321) : error C2039: 'type_info' : is not a member of 'std'
        f:/c++/boost_1_33_1/boost/shared_ptr.hpp(342) : see reference to class template instantiation 'boost::shared_ptr' being compiled
f:/c++/boost_1_33_1/boost/shared_ptr.hpp(321) : error C2039: 'type_info' : is not a member of 'std'
        c:/program files/microsoft visual studio/vc98/include/utility(26) : see reference to class template instantiation 'boost::shared_ptr' being compiled
        c:/program files/microsoft visual studio/vc98/include/xtree(28) : see reference to class template instantiation 'std::pair >' being compiled
        c:/program files/microsoft visual studio/vc98/include/map(46) : see reference to class template instantiation 'std::_Tree >,struct std::map,class boost::shared_ptr,struct std::less,class std::allocator > >::_Kfn,struct std::less,class std::allocatorct> > >' being compiled
        f:/vc6/tinyorm/orm/abstractmapper.h(96) : see reference to class template instantiation 'std::map,struct std::less,class std::allocatortentObject> > >' being compiled
PersistentObject.cpp

 

 

跟踪发现,原来错误的代码出现在(红色处):

 

void * _internal_get_deleter(std::type_info const & ti) const
    {
        return pn.get_deleter(ti);
    }

 

将代码中的 std::一一 去掉后(搜索一下,有好几处),居然编译通过。

 

 

分析原因:

         type_info 为运行时类型识别功能提供支持,vc++6.0 环境中自带了TYPEINFO.H头文件(在路径C:/Program Files/Microsoft Visual Studio/VC98/Include下),而该文件中定义的class type_info 并不在std 的namespace中。

 

 

 

你可能感兴趣的:(shared_ptr.hpp(321) : error C2039: 'type_info' : is not a member of 'std' 错误修正)