VC.STL Newsgroup Good Questions(
三
)
????
?
聲明
Container
對象時有許多
C 4786
編譯警告,
Why?
Article last modified on 2002-5-29
----------------------------------------------------------------
The information in this article applies to:
-
???????
Microsoft Visual C++, 32-bit Editions, version 6.0, SP5
----------------------------------------------------------------
?
Question:
下面的代碼編譯時報告了一大堆愚蠢的
C4786
編譯警告,足有十四個:
f:\program files\microsoft visual studio\vc98\include\list(125) : warning C4786: '?$reverse_bidirectional_iterator@Viterator@?$list@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@AAV43@PAV43@H' : identifier was truncated to '255' characters in the browser information ??????? E:\ \Exercise4\Exercise4.cpp(195) : see reference to class template instantiation 'std::list<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >' being compiled
?
代碼如下:
#include <string>
using namespace std;
list<string> myList;
void main()
{
}
?
再比如,
map<string,int> myMap
。
|
?
Answer:
這個警告的意思就是說,
list<string>
的構造生成的
Symbols
太長了,超過了255個字符。
你其實不用理會這個警告,因為它只會影響到
Debugger
,而不會影響到真實的代碼。實際上,如果你編譯一個
Release
版本的話,就會發現這個警告已經完全消失了。
消除這個警告可能有一點難度,因為這屬于預處理器的行為。
一般建議你這么做:
#pragma warning(disable : 4786)
#include <list>
#include <string>
?
注意這個
pragma
聲明一定要放在
stl
頭文件之前!否則不起作用!
?
這個
pragma
也不是總能夠發生效力的!有時候,并不能消除所有的這種
C4786
警告。
詳情參見:
http://support.microsoft.com/support/kb/articles/Q167/3/55.ASP
微軟聲稱,將在
Microsoft Visual C++ .NET
中解決這個問題。
|
?
(To be Continued)
?
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=12675
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
