相同的代码在gcc 4.5.2上工作正常但是当尝试在gcc 4.1.2上编译时,我得到了错误‘runtime_error’ was not declared in this scope.
我有
#include <stdexcept>
Run Code Online (Sandbox Code Playgroud)
这是gcc 4.1.2的问题吗?
代码摘录
// Constructor
if (resource cannot be acquired)
throw std::runtime_error("Blah Blah");
Run Code Online (Sandbox Code Playgroud)
你有using namespace std;还是using std::runtime_error;?如果没有,那么你需要完全限定名称和使用std::runtime_error而不仅仅是runtime_error.
| 归档时间: |
|
| 查看次数: |
13186 次 |
| 最近记录: |