本文介绍了runtime_error未在此范围中为g ++ 4.1.2声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
同样的代码在gcc 4.5.2上正常工作,但是当试图在gcc 4.1.2上编译它时,我得到的错误'runtime_error'没有在这个范围内声明
。
我有
#include< stdexcept> ;
这是gcc 4.1.2的问题吗?
代码摘录
//构造函数
if(resource can not be acquired)
throw std :: runtime_error(Blah Blah); Visual Studio说, runtime_error
应在< stdexcept>
中定义,所以我猜测GCC 4.1.2在这里已过时了。
The same code is working fine on gcc 4.5.2 but when trying to compile it on gcc 4.1.2, I get the error ‘runtime_error’ was not declared in this scope
.
I do have
#include <stdexcept>
Is this a problem with gcc 4.1.2?
Code excerpt
// Constructor
if (resource cannot be acquired)
throw std::runtime_error("Blah Blah");
解决方案 Visual Studio says that runtime_error
should be defined in <stdexcept>
, so I'm guessing that GCC 4.1.2 is just out of date here.
这篇关于runtime_error未在此范围中为g ++ 4.1.2声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!