VS2008, 写一个简单的demo的时候出现了这个:

1>------ Build started: Project: GetExportTable, Configuration: Release Win32 ------
1>Compiling...
1>main.cpp
1>e:\tzcode\getexporttable\getexporttable\GetExportTable.h(61) : warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> E:\TzSoft\VS2008\VC\include\stdio.h(306) : see declaration of 'scanf'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xtree(1466) : see declaration of 'std::operator <'
1> E:\TzSoft\VS2008\VC\include\functional(142) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1> with
1> [
1> _Ty=std::string
1> ]
1> E:\TzSoft\VS2008\VC\include\map(68) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
1> E:\TzSoft\VS2008\VC\include\xtree(22) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=int,
1> _Pr=std::less<std::string>,
1> _Alloc=std::allocator<std::pair<const std::string,int>>,
1> _Mfl=false
1> ]
1> E:\TzSoft\VS2008\VC\include\xtree(63) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,int,std::less<std::string>,std::allocator<std::pair<const std::string,int>>,false>
1> ]
1> E:\TzSoft\VS2008\VC\include\xtree(89) : see reference to class template instantiation 'std::_Tree_ptr<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,int,std::less<std::string>,std::allocator<std::pair<const std::string,int>>,false>
1> ]
1> E:\TzSoft\VS2008\VC\include\xtree(107) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,int,std::less<std::string>,std::allocator<std::pair<const std::string,int>>,false>
1> ]
1> E:\TzSoft\VS2008\VC\include\map(78) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,int,std::less<std::string>,std::allocator<std::pair<const std::string,int>>,false>
1> ]
1> .\main.cpp(65) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=int
1> ]
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xtree(1466) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xtree(1466) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xtree(1466) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\vector(1320) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\vector(1320) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\vector(1320) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\vector(1320) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\list(1310) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\list(1310) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\list(1310) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\list(1310) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xutility(2236) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xutility(2236) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xutility(2236) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xutility(2236) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xutility(2046) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xutility(2046) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xutility(2046) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xutility(2046) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\utility(84) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\utility(84) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\utility(84) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\utility(84) : see declaration of 'std::operator <'
1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
1>Build log was saved at "file://e:\TzCode\GetExportTable\GetExportTable\Release\BuildLog.htm"
1>GetExportTable - 25 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

开始把注意力集中在

1>E:\TzSoft\VS2008\VC\include\functional(143) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> E:\TzSoft\VS2008\VC\include\xtree(1466) : see declaration of 'std::operator <'

还以为是std::string没了 operator<

又怀疑是否是模板实例化的时候有啥别的问题(const, 类型转化之类的).

最后在网上搜了一下原来是没有#include <string>

但是为啥没报string是未定义标识符?

猜测可能是在哪个头文件里面声明了class string, 但是没有实现. 于是会找不到 string 的operator< .

具体原因有待进一步考证

could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'的更多相关文章

  1. 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)'

    error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Tra ...

  2. Error 2 error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)'

    Error 2 error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree ...

  3. 无法从“重载函数类型”为“const std::_Tree<_Traits> &”推导 <未知> 参数

    场景: 原因: 用到string类型,但是没有包含头文件. 解决方法: #include<string>

  4. Template within template: why “`>>' should be `> >' within a nested template argument list” 解决方法

    如果直接这样写: std::vector<boost::shared_ptr<int>> intvec; gcc编译器会把">>"当成opera ...

  5. C++ Templates (1.2 模板实参推断 Template Argument Deduction)

    返回完整目录 目录 1.2 模板实参推断 Template Argument Deduction 1.2 模板实参推断 Template Argument Deduction 当调用函数模板(如max ...

  6. 高德地图引入库错误std::string::find_first_of(char const*, unsigned long, unsigned long) const"

    一:std:编译器错误解决 二:错误提示 "std::string::find_first_of(char const*, unsigned long, unsigned long) con ...

  7. '>>' should be '> >' within a nested template argument list

    在编译关于opencv相机标定的工程的时候出现了这个问题 vector<vector<Point3f>>  objectPoints;  error: 'objectPoint ...

  8. std::u32string conversion to/from std::string and std::u16string

    I need to convert between UTF-8, UTF-16 and UTF-32 for different API's/modules and since I know have ...

  9. variadic templates & pass by const reference & member operator [] in const map & gcc sucks

    /// bugs code with comments #include <iostream> #include <memory> #include <unordered ...

随机推荐

  1. HDU 1892 See you~ (二维树状数组)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1892 See you~ Problem Description Now I am leaving h ...

  2. phpcmsv9多表联合查询分页功能实现

    phpcms v9里面自带的listinfo分页函数蛮好用的,可惜啊.不支持多表查询并分页. 看了一下前台模板层支持get标签,支持多表查询,支持分页.刚好可以把这个功能搬到后台来使用. 我们现在对g ...

  3. Linux下配置一个VNC服务器

    在Linux下配置一个VNC服务器,并设置2个用户,要求其中一个用户登录时不需要输入密码. 然后在客户端使用ssh+vncview的方式访问. 1确认vnc安装 2配置vncserver 3测试vnc ...

  4. php摇杆Tiger摇奖

    先说下整体思路,代码已附下方. 1.递归产生一个非中奖数(即非连续数字:'111','222','333','444','555','666','777','888') 2.点击摇奖,把奖项通过设置的 ...

  5. 复制文件的问题:使用FileInputStream和FileOutputStream实现文件复制

    public class Test{ public static void main(String [] args) { Test t=new Test(); t.upload(); } public ...

  6. Windows下的Memcache安装 linux下的Memcache安装

    linux下的Memcache安装: 1. 下载 memcache的linux版本,注意 memcached 用 libevent 来作事件驱动,所以要先安装有 libevent. 官方网址:http ...

  7. 遍历ArrayList时同时修改引发的问题

    看见一篇博客,没有写完整,于是增补了一下: 博客原文:http://www.cnblogs.com/alipayhutu/archive/2012/08/11/2634073.html 注:黄色字体为 ...

  8. IOS网络第四天 -网络文件上传(0923略)

    01-NSURLSession02-断点续传 02-文件上传01-基本的上传 03-文件上传03-代码封装 04-文件上传04-获得MIMEType.mp4 05-文件的压缩和解压缩.mp4 06-压 ...

  9. Windows 7无法卸载及安装IE11的解决方法

    1. 清空 C:\Windows\TEMP\  中的所有内容 2. 以管理员身份运行命令行,在命令中行输入下面的代码: FORFILES /P %WINDIR%\servicing\Packages ...

  10. Sprint会议记录(第五组)

    会议时间:12/8 下午14:00 会议地点:宿舍 会议进程: *首先我们讨论了实验第一个Sprint1要实现的功能:排球规则分析.比赛详细过程.比赛人物分析, *之后对是任务的认领, *最后每个人对 ...