免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3068 | 回复: 7
打印 上一主题 下一主题

怎样才能看懂vc所编译出的错误代码 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-03-22 22:34 |只看该作者 |倒序浏览
怎样才能看懂vc所编译出的错误代码:例如
Compiling...
map.cpp
c:\program files\microsoft visual studio\vc98\include\xtree(11 : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,
std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *,std::less<st
d::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >' : identifier was truncated to '255' characters in the debug information
        c:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<
char>,std::allocator<char> > const ,std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::pair<short,short>,std::allocator<std::
pair<short,short> > > *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >::_Kfn,std::less<std::basic_string<char,std::cha
r_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >' being compiled
        c:\users\acer\desktop\stl\map.cpp(292) : see reference to class template instantiation 'std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> >
> *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >' being compiled
c:\program files\microsoft visual studio\vc98\include\xtree(11 : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,
std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *,std::less<st
d::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >::const_iterator' : identifier was truncated to '255' characters in the debug information
        c:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<
char>,std::allocator<char> > const ,std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::pair<short,short>,std::allocator<std::
pair<short,short> > > *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >::_Kfn,std::less<std::basic_string<char,std::cha
r_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >' being compiled
        c:\users\acer\desktop\stl\map.cpp(292) : see reference to class template instantiation 'std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> >
> *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >' being compiled
c:\program files\microsoft visual studio\vc98\include\xtree(11 : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,
std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *,std::less<st
d::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::vector<std::pair<short,short>,std::allocator<std::pair<short,short> > > *> >::iterator' : identifier was truncated to '255' characters in the debug information
     基本上都是这样的编译结果。

以前看见过一个文档解释怎样去除编译结果中无用的信息(重复的或者套话),从而得到简化的编译结果。就可以清楚地知道错误所在。

论坛徽章:
14
巨蟹座
日期:2013-11-19 14:09:4615-16赛季CBA联赛之青岛
日期:2016-07-05 12:36:0515-16赛季CBA联赛之广东
日期:2016-06-29 11:45:542015亚冠之全北现代
日期:2015-07-22 08:09:472015年辞旧岁徽章
日期:2015-03-03 16:54:15巨蟹座
日期:2014-12-29 08:22:29射手座
日期:2014-12-05 08:20:39狮子座
日期:2014-11-05 12:33:52寅虎
日期:2014-08-13 09:01:31巳蛇
日期:2014-06-16 16:29:52技术图书徽章
日期:2014-04-15 08:44:01天蝎座
日期:2014-03-11 13:06:45
2 [报告]
发表于 2012-03-22 22:45 |只看该作者
换个不那么远古的编译器

论坛徽章:
0
3 [报告]
发表于 2012-03-22 23:01 |只看该作者
能不能不用这么长的标示符啊?自己把自己搞晕了, 怪谁

论坛徽章:
324
射手座
日期:2013-08-23 12:04:38射手座
日期:2013-08-23 16:18:12未羊
日期:2013-08-30 14:33:15水瓶座
日期:2013-09-02 16:44:31摩羯座
日期:2013-09-25 09:33:52双子座
日期:2013-09-26 12:21:10金牛座
日期:2013-10-14 09:08:49申猴
日期:2013-10-16 13:09:43子鼠
日期:2013-10-17 23:23:19射手座
日期:2013-10-18 13:00:27金牛座
日期:2013-10-18 15:47:57午马
日期:2013-10-18 21:43:38
4 [报告]
发表于 2012-03-23 08:42 |只看该作者
本帖最后由 hellioncu 于 2012-03-23 08:42 编辑

VC6对模板支持不好,这个“ identifier was truncated to '255' characters in the debug information”的警告是去不掉的,当它不存在吧

论坛徽章:
14
巨蟹座
日期:2013-11-19 14:09:4615-16赛季CBA联赛之青岛
日期:2016-07-05 12:36:0515-16赛季CBA联赛之广东
日期:2016-06-29 11:45:542015亚冠之全北现代
日期:2015-07-22 08:09:472015年辞旧岁徽章
日期:2015-03-03 16:54:15巨蟹座
日期:2014-12-29 08:22:29射手座
日期:2014-12-05 08:20:39狮子座
日期:2014-11-05 12:33:52寅虎
日期:2014-08-13 09:01:31巳蛇
日期:2014-06-16 16:29:52技术图书徽章
日期:2014-04-15 08:44:01天蝎座
日期:2014-03-11 13:06:45
5 [报告]
发表于 2012-03-23 11:14 |只看该作者
回复 4# hellioncu


    #pragma warning (disable : 4786)
加在#include之前

论坛徽章:
0
6 [报告]
发表于 2012-03-23 11:36 |只看该作者
百度

论坛徽章:
324
射手座
日期:2013-08-23 12:04:38射手座
日期:2013-08-23 16:18:12未羊
日期:2013-08-30 14:33:15水瓶座
日期:2013-09-02 16:44:31摩羯座
日期:2013-09-25 09:33:52双子座
日期:2013-09-26 12:21:10金牛座
日期:2013-10-14 09:08:49申猴
日期:2013-10-16 13:09:43子鼠
日期:2013-10-17 23:23:19射手座
日期:2013-10-18 13:00:27金牛座
日期:2013-10-18 15:47:57午马
日期:2013-10-18 21:43:38
7 [报告]
发表于 2012-03-23 13:01 |只看该作者
bruceteen 发表于 2012-03-23 11:14
回复 4# hellioncu


我怎么记得以前VC6里面,某些警告无法disable掉,包括这个4786

论坛徽章:
0
8 [报告]
发表于 2012-03-23 13:47 |只看该作者
有个大师写过一个工具,可以将这种复杂的错误信息,变为最终的简洁的错误信息。

不过工具的名字我不记得了。因为我认为不能依赖于这种工具,还是靠自己,随着经验的增长,就可以定位问题了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP