对于 g++ 4.1.2,runtime_error 未在此范围内声明

2024-02-16

相同的代码在 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 在这里已经过时了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

对于 g++ 4.1.2,runtime_error 未在此范围内声明 的相关文章

随机推荐