vendredi 25 décembre 2015

Simple Qt app with C++ 11 doesn't compile with MinGW32

I'm trying to pass my build on Appveyor but I facing a compilation problem.

Given the following simple Qt project:

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

TARGET = ConsoleTest02
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

CONFIG += c++11

And source code:

// main.cpp
#include <QCoreApplication>

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

    return a.exec();
}

I have the following error:

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)); }
                              ^

The error disappear if I remove the following line from ConsoleTest.pro:

CONFIG += c++11

I'm using Qt 5.4 with MinGW 4.9.1 32 bit.

Any idea?

Aucun commentaire:

Enregistrer un commentaire