Eug*_*Loy 19 qt runtime-error mingw
我尝试使用Qt(4.6.3)+ MinGW编译以下代码:
#include <QtCore/QCoreApplication>
#include <exception>
int main(int argc, char *argv[])
{
throw std::runtime_error("");
QCoreApplication a(argc, argv);
return a.exec();
}
Run Code Online (Sandbox Code Playgroud)
......并得到了这个错误:
..\untitled11\main.cpp:6: error: 'runtime_error' is not a member of 'std'
Run Code Online (Sandbox Code Playgroud)
项目从头创建(控制台应用程序),专业文件:
QT += core
QT -= gui
TARGET = untitled11
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
Run Code Online (Sandbox Code Playgroud)
试图用Qt + MSVC2008编译器编译这个 - 工作正常.
这是标准的例外,不知道为什么会丢失.
Cha*_*esB 53
<exception>仅定义基std::exception类; 如果你想要子类std::runtime_error,你必须包括<stdexcept>标题.