使用C ++ 11的简单Qt应用程序无法使用MinGW32进行编译

时间:2015-12-25 16:30:41

标签: qt c++11 mingw32 appveyor

我正在尝试在Appveyor上传递我的构建,但我遇到了编译问题。

给出以下简单的 Qt 项目:

// ConsoleTest.pro
QT += core
QT -= gui

TARGET = ConsoleTest02
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

CONFIG += c++11

源代码:

// main.cpp
#include <QCoreApplication>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    return a.exec();
}

我有以下错误:

In file included from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\cmath:44:0,
             from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\random:38,
             from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:65,
             from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\algorithm:62,
             from ../../Qt/5.4/mingw491_32/include/QtCore/qglobal.h:81,
             from ../../Qt/5.4/mingw491_32/include/QtCore/qcoreapplication.h:37,
             from ../../Qt/5.4/mingw491_32/include/QtCore/QCoreApplication:1,
             from ConsoleTest02/main.cpp:1:
c:\mingw\include\math.h: In function 'float hypotf(float, float)':
c:\mingw\include\math.h:635:30: error: '_hypot' was not declared in this scope
 { return (float)(_hypot (x, y)); }
                              ^

如果我从 ConsoleTest.pro 中删除以下行,则错误消失:

CONFIG += c++11

我正在使用 Qt 5.4 MinGW 4.9.1 32位

有什么想法吗?

0 个答案:

没有答案