【发布时间】:2015-03-05 11:18:23
【问题描述】:
我正在尝试在大型代码库中追踪此大型警告的来源:
C:\Program Files (x86)\Microsoft Visual Studio 12.\VC\INCLUDE\xmemory0(592) :
warning C4503:
'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::_Insert_at' : decorated name length exceeded, name was truncated
with
[
_Kty=epmem_node_id,
_Ty=std::map<std::string,std::list<std::string,std::allocator<std::string>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::list<std::string,std::allocator<std::string>>>>>,
_Pr=std::less<epmem_node_id>,
_Alloc=std::allocator<std::pair<const epmem_node_id,std::map<std::string,std::list<std::string,std::allocator<std::string>>,std::less<std::string>, std::allocator<std::pair<const std::string,std::list<std::string,std::allocator<std::string>>>>>>>
]
我正计划添加以下内容以使其静音:
#pragma warning(push)
#pragma warning(disable:4503)
... code here
#pragma warning(pop)
但是,我一直将它放在代码库中,但仍然会弹出警告。不幸的是,警告没有指定问题所在的行、文件甚至类或变量,所以我完全迷失了。我尝试使用dumpbin /ALL,但是当我搜索文件时,我在任何地方都没有找到_Tree。
如何在我的代码库中找到此警告的来源?
【问题讨论】:
-
那是 complete 错误日志输出吗?没有什么更能说明问题出在你的代码的什么地方了?
-
可能是一些声明,例如:
map_obj[string_obj] = list_obj; -
在模板的情况下,#pragma 的放置位置非常不直观,模板扩展发生得很晚。当你把它放在源代码文件的 end 时它可以工作:)
-
@JoachimPileborg 是的,这就是完整的日志。没有位置指示。
-
当它位于 .cpp 文件的最后时,当然没有什么可弹出的。这也不会影响您项目中的任何其他文件。让它变得简单,不是吗:)
标签: c++ debugging visual-studio-2012 warnings pragma