Important: Please read the Qt Code of Conduct -

[SOLVED] Qt 5.0.1 on Mac OS X can't use unique_ptr

  • I'm trying to use unique_ptr (smart pointer from c++11) in my simple Qt 5 application, I have MainWindow and NotificationWindow.

    I have this in my .pro file
    QMAKE_CXXFLAGS += -std=c++11

    First, my spec, auto generated in Qt Creator was just macx-clang and build was giving me the following errors:
    /Users/administrator/Qt5.0.1/5.0.1/clang_64/include/QtCore/qlist.h:52: error: 'initializer_list' file not found
    #include <initializer_list>

    So I added to qmake arguments list this:
    @-spec macx-clang-libc++@

    But I'm getting the following error:
    /usr/lib/c++/v1/memory:2483: error: invalid application of 'sizeof' to an incomplete type 'Ui::NotificationDialog'
    static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type");

    Any clues how to use unique_ptr on Mac OS X with Qt 5.0.1 and Qt Creator 2.6 ?

  • I solved my problem by creating a missing destructor for NotificationDialog class in the implementation NotificationDialog.cpp file


    But still

    @-spec macx-clang-libc++@

    is needed to use smart pointers.

Log in to reply