Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
请参见Visual Studio中的临时值 我的C++程序运行成一个异常的异常,看起来像 throw std::runtime_error(“由于错误而失败”+std::to_string(getError());_C++_Visual Studio - Fatal编程技术网

请参见Visual Studio中的临时值 我的C++程序运行成一个异常的异常,看起来像 throw std::runtime_error(“由于错误而失败”+std::to_string(getError());

请参见Visual Studio中的临时值 我的C++程序运行成一个异常的异常,看起来像 throw std::runtime_error(“由于错误而失败”+std::to_string(getError());,c++,visual-studio,C++,Visual Studio,调试器在此行暂停程序。由于语言规则,必须在引发异常之前创建内容为“failed with error-1”的std::runtime_error,因此我知道某个地方有一个类型为std::runtime_error的临时对象,但我不确定最后的数字。如何使用调试器查看该对象/字符串?它显示了所有已命名的局部变量,但没有显示未命名的。更改代码以给临时文件命名、重新编译和复制错误会在一段时间后花费大量时间,并且对于罕见的错误来说是不可行的 我目前正在Windows 7下使用Visual Studio E

调试器在此行暂停程序。由于语言规则,必须在引发异常之前创建内容为“failed with error-1”的
std::runtime_error
,因此我知道某个地方有一个类型为
std::runtime_error
的临时对象,但我不确定最后的数字。如何使用调试器查看该对象/字符串?它显示了所有已命名的局部变量,但没有显示未命名的。更改代码以给临时文件命名、重新编译和复制错误会在一段时间后花费大量时间,并且对于罕见的错误来说是不可行的


我目前正在Windows 7下使用Visual Studio Express 2013作为桌面,我愿意切换到Visual Studio 2015 CTP等替代方案。

在这一行设置断点。当程序停止时,点击
F11
(单步执行),进入
std::runtime\u error
的构造函数。在那里,字符串将在
Autos
选项卡上可用,因为它将作为参数出现。

因此,
getError()
返回
-1
。你还想看什么?@Lingxi我不知道它会返回-1。也许它返回42。我看不到字符串,这是一个例子。然后,你可以捕获异常并执行
std::cout@Lingxi如果我这样做,我会看到异常文本,但没有局部变量和堆栈跟踪。不错。仍然需要重新启动,但不会使我重新编译。