作者:kuqu00 | 来源:互联网 | 2023-10-11 14:44
我要看懂下面的,应该看些什么书,谢谢啊:\programfiles\microsoftvisualstudio\vc98\include\vector(39):warningC4786:
我要看懂下面的,应该看些什么书,谢谢啊
:\program files\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::reverse_iterator
,std::allocator > const *,std::basic_string,std::allocator
>,std::basic_string,std::allocator > const &,std::basic_string,std::allocator > const *,int>' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(39) : while compiling class-template member function '__thiscall std::vector,std::allocator >,std::allocatorhar,std::char_traits,std::allocator > > >::std::vector,std::allocator >,std::allocator,std::allocator > > >(const std::allocator:basic_string,std::allocator > > &)'
c:\program files\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::reverse_iterator,std::allocator > *,std::basic_string,std::allocator >,std:
:basic_string,std::allocator > &,std::basic_string,std::allocator > *,int>' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(39) : while compiling class-template member function '__thiscall std::vector,std::allocator >,std::allocatorhar,std::char_traits,std::allocator > > >::std::vector,std::allocator >,std::allocator,std::allocator > > >(const std::allocator:basic_string,std::allocator > > &)'
c:\program files\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > >
>::vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > >
>::~vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information
f:\guo\学生管理\trans.cpp(130) : warning C4715: 'transfer::find' : not all control paths return a value
f:\guo\学生管理\student.cpp(105) : warning C4715: 'course::getscore' : not all control paths return a value
8 个解决方案
STD内部有很多的WARNING DISABLE开关,都是些麻烦的东西,VC最爱弄出这些东西4786
关掉久好了
检查那两个函数。
如果有分支,不管选择哪条都要返回一个值。
f:\guo\学生管理\trans.cpp(130) : warning C4715: 'transfer::find' : not all control paths return a value
f:\guo\学生管理\student.cpp(105) : warning C4715: 'course::getscore' : not all control paths return a value
这两个好像不是内部WARNING
说明你不是所有的分支都有确定的返回值,
那怎么关啊?
那这些warning不需要关注?
还有我还是不知道什么是4786
还有我还是不知道什么是4786
--------------------------------
查MSDN
4786警告:identifier was truncated to '255' characters in the debug information
是模板的名字太长造成的,不影响程序正常执行.可以在CPP文件的最顶上加上:
#pragma warning(disable:4786)
关掉警告
后面的两个警告说明你程序逻辑结构上有问题.
int f(int x)
{
if(x==10)
return 100;//就象这个,当x!=10它就不知道返回什么了.会有C4715警告.
}
改成这样就好了:
int f(int x)
{
if(x==10)
return 100;//
else
return 0
}