[Updated with minimal reproducing example] Mac OS X 10.9: can't compile a project with Qt 5.2 beta



  • I'm trying to check Qt 5.2 to see if OS X 10.9-specific bugs have been fixed, but can't build my project. I have C++11 disabled (no CONFIG+=C++11), but I use some older C++0x features so I have -std=c++0x.

    The problem is that for some reason C++11-specific defines get defined somewhere (in the mkspec?), and since I don't have C++11 support it fails to compile. Any ideas on how to fix it without enabling C++11?



  • Actually, even with CONFIG+=C++11 and QMAKE_CXXFLAGS+=-std=c++11 I get a lot of weird errors (not with ‘initializer_list, though, that seems to have solved). Is mkspec broken in Qt 5.2 on 10.9?



  • Disregard my previous message, there might have been a mess with compiler flags. Let's return to the initial problem with initializer_list. Steps to reproduce:

    1. Install "Qt 5.2 beta for Mac OS X":http://download.qt-project.org/development_releases/qt/5.2/5.2.0-beta1/
    2. Create a new console application project with Qt Creator using Qt 5.2 kit.
    3. Add QMAKE_CXXFLAGS+=-std=c++0x to the project file. My project looks like this:

    @QT += core

    TARGET = Test
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    QMAKE_CXXFLAGS+=-std=c++0x

    SOURCES += main.cpp
    @

    1. main.cpp:

    @#include <QList>

    int main(int, char *[])
    {
    return 0;
    }@

    1. Attempt to compile, it will fail. Output:

    @In file included from ../Test/main.cpp:1:
    In file included from ../Qt5.2.0/5.2.0-beta1/clang_64/lib/QtCore.framework/Versions/5/Headers/QList:1:
    ../Qt5.2.0/5.2.0-beta1/clang_64/lib/QtCore.framework/Versions/5/Headers/qlist.h:53:10: fatal error: 'initializer_list' file not found
    #include <initializer_list>
    ^
    1 error generated.@



  • I had some problem, it solved by adding
    @CONFIG += c++11@
    instead of
    @CONFIG += C++11@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.