“呼叫栈” Visual Studio 2005中的C ++错误 [英] "Call Stack" for C++ errors in Visual Studio 2005

查看:82
本文介绍了“呼叫栈” Visual Studio 2005中的C ++错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2005(C ++)中是否存在针对编译器错误的调用堆栈?

Is there a "call stack" for compiler errors in Visual Studio 2005 (C++)?

例如,我使用boost :: scoped_ptr作为值在QHash中。但是,这会导致以下编译错误:

For example, I am using a boost::scoped_ptr as the value in a QHash. This is however causing the following compile error:

1>c:\qt\include\qtcore\../../src/corelib/tools/qhash.h(743) : error C2248: 'boost::scoped_ptr<T>::operator =' : cannot access private member declared in class 'boost::scoped_ptr<T>'

从生成输出中,我知道是哪个源文件引起了错误,并且行号qhash.h导致了错误,但我试图在生成错误的 my 源文件中跟踪行号(因此有了调用堆栈的想法)。

From the build output I know which of my source files is causing the error and the line number in the qhash.h that is causing the error but I am trying to track down the line number in my source file that is generating the error (hence the "call stack" idea).

请注意,我不是在寻找在QHash中使用scoped_ptr的问题的解决方案,而是在寻找生成编译错误的位置的解决方案。这对于帮助跟踪奇怪的警告也很有用。

Please note, I am not looking for the solution to the problem of using a scoped_ptr in a QHash but the problem of tracking down where compile errors are generated. This would also be useful for helping track down weird warnings. More often than not I run into this problem when using templated classes.

谢谢!

推荐答案

有时会出现奇怪的错误,它有助于预处理文件并查看该输出。使用VS,请在预处理器设置下查找 Generate Preprocessed File(或设置/ P开关)。这将从XXX.cpp中生成XXX.i,这可能有助于您解决问题。

Sometimes with strange errors it helps to preprocess the file and look at that output. With VS look for "Generate Preprocessed File" under preprocessor settings (or set the /P switch). This will generate XXX.i from XXX.cpp which may help you figure out the problem.

请确保您先关闭开关,然后打开此选项,这样才能赢得胜利。不会生成obj文件。

Make sure you turn off the switch after, with this option turned on it won't generate an obj file.

这篇关于“呼叫栈” Visual Studio 2005中的C ++错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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