如何在Visual Studio中查看模板编译器错误详细信息 [英] How to view template compiler error details in Visual Studio

查看:407
本文介绍了如何在Visual Studio中查看模板编译器错误详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2015,但遇到很多编译器错误,但我无法弄清这些错误的根源在哪里:

I am working with Visual Studio 2015 and I'm getting a lot of compiler errors but I can't figure out where the root cause of those is:

双击突出显示的错误会将我带到list文件到operator==:

Double-clicking on the highlighted error takes me into the list file to the operator==:

template<class _Ty,
class _Alloc> inline
bool operator==(const list<_Ty, _Alloc>& _Left,
    const list<_Ty, _Alloc>& _Right)
{   // test for list equality
return (_Left.size() == _Right.size()
    && _STD equal(_Left.begin(), _Left.end(), _Right.begin()));
}

嗯,那无济于事.由于我正在从事一个大型项目,因此我不知道该错误的根本原因在哪里,即使用std::list的代码在哪里会导致该错误?

Well, that doesn't help. Since I am working on a huge project, I don't know where the root cause of that error is, i.e. where is the code which uses the std::list in a way that causes this error?

如果我没记错的话,我认为XCode会显示此类错误的堆栈.
如何找出此错误的根源?

I think XCode shows a stack for such errors, if I remember correctly.
How can I find out where this error originates?

推荐答案

如注释中所述,输出"选项卡(Ctrl + Alt + O)显示来自编译器的所有消息. 错误列表"选项卡仅显示一条消息,即实际错误,正如您所说,对于模板编译问题而言,它并不是很有帮助.

As discussed in the comments, the Output tab (Ctrl+Alt+O) shows all the messages from the compiler. The Error List tab just shows one message, the actual error, which, as you said, for template compilation problems is not very helpful. What I have found works rather well (it is a little tedious, but it does work), is to

  1. 双击错误列表"选项卡中的消息.
  2. 切换到输出"标签
  3. 使用F8转到链中的下一条消息(将F8移至上一条消息)

这篇关于如何在Visual Studio中查看模板编译器错误详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆