相同的代码在 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/