c++ - runtime_error 未在此范围内为 g++ 4.1.2 声明

标签 c++ linux gcc

相同的代码在 gcc 4.5.2 上运行良好,但是当尝试在 gcc 4.1.2 上编译它时,出现错误 'runtime_error' was not declared in this scope

我有

#include <stdexcept>

这是 gcc 4.1.2 的问题吗?

代码摘录

// Constructor
if (resource cannot be acquired)
  throw std::runtime_error("Blah Blah");

最佳答案

Visual Studio 表示 runtime_error应在 <stdexcept> 中定义,所以我猜 GCC 4.1.2 在这里已经过时了。

关于c++ - runtime_error 未在此范围内为 g++ 4.1.2 声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5527091/

相关文章:

c++ - 按位运算n&(n-1)有什么作用?

c - x86_64-pc-cygwin gcc编译错误

linux - curl 正在从 gitlab 下载 html 而不是实际的 zip 文件

linux - 在另一个脚本中使用脚本的结果

c - arm-linux-androideabi-gcc 没有那个文件

c - 为什么while循环会清除一个变量?

c++ - htmlcxx 编译错误

c++ - 使用 CComObjects 的工厂模式

gcc - 将 gcc 与 MinGW 一起使用

c++ - 如何在不添加换行符的情况下将文本附加到 QPlainTextEdit,并将滚动保持在底部?