MSVC - 使用消息

时间:2015-04-22 13:54:11

标签: c++ visual-studio-2012

我有一个使用大量模板和模板特化的应用程序,并且在MSVC编译期间输出许多消息,显示模板的编译方式。这使得查找实际编译错误非常困难。使用g ++在Linux上编译应用程序时,不会输出这些消息。

    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\map(382)
: see reference to function template instantiation 'std::pair<std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>,bool> std:
:_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,true>>::insert<std::pair<std::string,uint64_t>>(_Valty &&)' being compiled
    with
    [
        _Kty=std::string
,            _Ty=size_t
,            _Pr=std::less<std::string>
,            _Alloc=std::allocator<std::pair<const std::string,size_t>>
,            _Valty=std::pair<std::string,uint64_t>
    ]

有没有办法可以抑制这些或多或少无用的消息?或者可能降低冗长设置?我试过看link,但我不确定是否有与我看到的消息有关的标志。

1 个答案:

答案 0 :(得分:0)

该消息与具有特定模板实例的警告(或错误)有关。如果是警告,您可以禁止它(通过#pragma警告或项目设置),此消息也会消失。或者,您可以修复警告的原因。没有抑制警告就无法抑制此消息,因为没有它,警告就没有多大意义。