Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Can't compile Qt 4.8.7



  • Hi

    I need to compile Qt 4.8.7 on my Linux Stretch 64bit.
    I have configure option:

    OPENSSL_LIBS='-L/usr/local/lib -lssl -lcrypto' ./configure -I/usr/local/include -platform linux-g++-64 -fast -opensource -confirm-license -prefix /home/franki/Qt/4.8/  -openssl-linked -no-webkit -no-qt3support -no-script -no-scripttools -nomake demos -nomake examples
    

    but it ends up with error for which I don't know what to do:

    In file included from itemviews.cpp:42:0:
    itemviews.h: In member function ‘virtual QAccessible::Role QAccessibleTable2CornerButton::role(int) const’:
    itemviews.h:280:19: warning: unused parameter ‘child’ [-Wunused-parameter]
         Role role(int child) const { Q_ASSERT(child == 0); return QAccessible::Pane; }
                       ^~~~~
    itemviews.h: In member function ‘virtual QAccessible::State QAccessibleTable2CornerButton::state(int) const’:
    itemviews.h:281:21: warning: unused parameter ‘child’ [-Wunused-parameter]
         State state(int child) const { Q_ASSERT(child == 0); return QAccessible::Normal; }
                         ^~~~~
    itemviews.h: In member function ‘virtual QRect QAccessibleTable2CornerButton::rect(int) const’:
    itemviews.h:282:20: warning: unused parameter ‘child’ [-Wunused-parameter]
         QRect rect(int child) const { Q_ASSERT(child == 0); return QRect(); }
                        ^~~~~
    itemviews.cpp: In member function ‘virtual bool QAccessibleTable2::unselectColumn(int)’:
    itemviews.cpp:396:105: error: conversion from ‘int’ to ‘QItemSelectionModel::SelectionFlags {aka QFlags<QItemSelectionModel::SelectionFlag>}’ is ambiguous
         view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
                                                                                                             ^
    In file included from ../../../../include/QtCore/qglobal.h:1:0,
                     from ../../../../include/QtCore/../../src/corelib/global/qnamespace.h:45,
                     from ../../../../include/QtCore/qnamespace.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qobjectdefs.h:45,
                     from ../../../../include/QtCore/qobjectdefs.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qobject.h:47,
                     from ../../../../include/QtCore/qobject.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qpointer.h:45,
                     from ../../../../include/QtCore/qpointer.h:1,
                     from itemviews.h:45,
                     from itemviews.cpp:42:
    ../../../../include/QtCore/../../src/corelib/global/qglobal.h:2436:29: note: candidate: constexpr QFlags<Enum>::QFlags(QFlags<Enum>::Zero) [with Enum = QItemSelectionModel::SelectionFlag; QFlags<Enum>::Zero = void**] <near match>
         Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
                                 ^~~~~~
    ../../../../include/QtCore/../../src/corelib/global/qglobal.h:2436:29: note:   conversion of argument 1 would be ill-formed:
    itemviews.cpp:396:74: error: invalid conversion from ‘int’ to ‘QFlags<QItemSelectionModel::SelectionFlag>::Zero {aka void**}’ [-fpermissive]
         view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
    In file included from ../../../../include/QtCore/qglobal.h:1:0,
                     from ../../../../include/QtCore/../../src/corelib/global/qnamespace.h:45,
                     from ../../../../include/QtCore/qnamespace.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qobjectdefs.h:45,
                     from ../../../../include/QtCore/qobjectdefs.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qobject.h:47,
                     from ../../../../include/QtCore/qobject.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qpointer.h:45,
                     from ../../../../include/QtCore/qpointer.h:1,
                     from itemviews.h:45,
                     from itemviews.cpp:42:
    ../../../../include/QtCore/../../src/corelib/global/qglobal.h:2435:29: note: candidate: constexpr QFlags<Enum>::QFlags(Enum) [with Enum = QItemSelectionModel::SelectionFlag] <near match>
         Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {}
                                 ^~~~~~
    ../../../../include/QtCore/../../src/corelib/global/qglobal.h:2435:29: note:   conversion of argument 1 would be ill-formed:
    itemviews.cpp:396:74: error: invalid conversion from ‘int’ to ‘QItemSelectionModel::SelectionFlag’ [-fpermissive]
         view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
    In file included from ../../../../include/QtGui/qitemselectionmodel.h:1:0,
                     from ../../../../include/QtGui/../../src/gui/itemviews/qabstractitemview.h:47,
                     from ../../../../include/QtGui/qabstractitemview.h:1,
                     from itemviews.h:47,
                     from itemviews.cpp:42:
    ../../../../include/QtGui/../../src/gui/itemviews/qitemselectionmodel.h:199:18: note:   initializing argument 2 of ‘virtual void QItemSelectionModel::select(const QModelIndex&, QItemSelectionModel::SelectionFlags)’
         virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
                      ^~~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::State QAccessibleTable2::state(int) const’:
    itemviews.cpp:415:49: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::State QAccessibleTable2::state(int child) const
                                                     ^~~~~
    itemviews.cpp: In member function ‘virtual QString QAccessibleTable2::text(QAccessible::Text, int) const’:
    itemviews.cpp:467:45: warning: unused parameter ‘child’ [-Wunused-parameter]
     QString QAccessibleTable2::text(Text t, int child) const
                                                 ^~~~~
    itemviews.cpp: In member function ‘virtual QRect QAccessibleTable2::rect(int) const’:
    itemviews.cpp:475:35: warning: unused parameter ‘child’ [-Wunused-parameter]
     QRect QAccessibleTable2::rect(int child) const
                                       ^~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::Role QAccessibleTable2Cell::role(int) const’:
    itemviews.cpp:785:51: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::Role QAccessibleTable2Cell::role(int child) const
                                                       ^~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::State QAccessibleTable2Cell::state(int) const’:
    itemviews.cpp:791:53: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::State QAccessibleTable2Cell::state(int child) const
                                                         ^~~~~
    itemviews.cpp: In member function ‘virtual QRect QAccessibleTable2Cell::rect(int) const’:
    itemviews.cpp:837:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
         if (!r.isNull())
         ^~
    itemviews.cpp:839:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
             r.translate(view->mapToGlobal(QPoint(0, 0)));
             ^
    itemviews.cpp:830:39: warning: unused parameter ‘child’ [-Wunused-parameter]
     QRect QAccessibleTable2Cell::rect(int child) const
                                           ^~~~~
    itemviews.cpp: In member function ‘virtual QString QAccessibleTable2Cell::text(QAccessible::Text, int) const’:
    itemviews.cpp:843:49: warning: unused parameter ‘child’ [-Wunused-parameter]
     QString QAccessibleTable2Cell::text(Text t, int child) const
                                                     ^~~~~
    itemviews.cpp: In member function ‘virtual void QAccessibleTable2Cell::setText(QAccessible::Text, int, const QString&)’:
    itemviews.cpp:864:53: warning: unused parameter ‘child’ [-Wunused-parameter]
     void QAccessibleTable2Cell::setText(Text /*t*/, int child, const QString &text)
                                                         ^~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::Relation QAccessibleTable2Cell::relationTo(int, const QAccessibleInterface*, int) const’:
    itemviews.cpp:938:61: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::Relation QAccessibleTable2Cell::relationTo(int child, const QAccessibleInterface *other, int otherChild) const
                                                                 ^~~~~
    itemviews.cpp:938:107: warning: unused parameter ‘otherChild’ [-Wunused-parameter]
     QAccessible::Relation QAccessibleTable2Cell::relationTo(int child, const QAccessibleInterface *other, int otherChild) const
                                                                                                               ^~~~~~~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::Role QAccessibleTable2HeaderCell::role(int) const’:
    itemviews.cpp:977:57: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::Role QAccessibleTable2HeaderCell::role(int child) const
                                                             ^~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::State QAccessibleTable2HeaderCell::state(int) const’:
    itemviews.cpp:985:59: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::State QAccessibleTable2HeaderCell::state(int child) const
                                                               ^~~~~
    itemviews.cpp: In member function ‘virtual QRect QAccessibleTable2HeaderCell::rect(int) const’:
    itemviews.cpp:991:45: warning: unused parameter ‘child’ [-Wunused-parameter]
     QRect QAccessibleTable2HeaderCell::rect(int child) const
                                                 ^~~~~
    itemviews.cpp: In member function ‘virtual QString QAccessibleTable2HeaderCell::text(QAccessible::Text, int) const’:
    itemviews.cpp:1020:55: warning: unused parameter ‘child’ [-Wunused-parameter]
     QString QAccessibleTable2HeaderCell::text(Text t, int child) const
    

    Does anybody know how to make it work?

    Best Regards
    Marek



  • The problem is:

    itemviews.cpp: In member function ‘virtual bool QAccessibleTable2::unselectColumn(int)’:
    itemviews.cpp:396:105: error: conversion from ‘int’ to ‘QItemSelectionModel::SelectionFlags {aka QFlags<QItemSelectionModel::SelectionFlag>}’ is ambiguous
         view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
    

    The problem here is, the code is trying to convert int into a Qt type, which is ambiguous, even if this type inherits int. (IDK).

    Try 4.8.6, which is the latest official 4.8 version I am able to find.



  • exactly the same error in qt 4.8.6
    Is it something with gcc? some flag?

    In file included from itemviews.cpp:42:0:
    itemviews.h: In member function ‘virtual QAccessible::Role QAccessibleTable2CornerButton::role(int) const’:
    itemviews.h:280:19: warning: unused parameter ‘child’ [-Wunused-parameter]
         Role role(int child) const { Q_ASSERT(child == 0); return QAccessible::Pane; }
                       ^~~~~
    itemviews.h: In member function ‘virtual QAccessible::State QAccessibleTable2CornerButton::state(int) const’:
    itemviews.h:281:21: warning: unused parameter ‘child’ [-Wunused-parameter]
         State state(int child) const { Q_ASSERT(child == 0); return QAccessible::Normal; }
                         ^~~~~
    itemviews.h: In member function ‘virtual QRect QAccessibleTable2CornerButton::rect(int) const’:
    itemviews.h:282:20: warning: unused parameter ‘child’ [-Wunused-parameter]
         QRect rect(int child) const { Q_ASSERT(child == 0); return QRect(); }
                        ^~~~~
    itemviews.cpp: In member function ‘virtual bool QAccessibleTable2::unselectColumn(int)’:
    itemviews.cpp:396:105: error: conversion from ‘int’ to ‘QItemSelectionModel::SelectionFlags {aka QFlags<QItemSelectionModel::SelectionFlag>}’ is ambiguous
         view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
                                                                                                             ^
    In file included from ../../../../include/QtCore/qglobal.h:1:0,
                     from ../../../../include/QtCore/../../src/corelib/global/qnamespace.h:45,
                     from ../../../../include/QtCore/qnamespace.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qobjectdefs.h:45,
                     from ../../../../include/QtCore/qobjectdefs.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qobject.h:47,
                     from ../../../../include/QtCore/qobject.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qpointer.h:45,
                     from ../../../../include/QtCore/qpointer.h:1,
                     from itemviews.h:45,
                     from itemviews.cpp:42:
    ../../../../include/QtCore/../../src/corelib/global/qglobal.h:2321:29: note: candidate: constexpr QFlags<Enum>::QFlags(QFlags<Enum>::Zero) [with Enum = QItemSelectionModel::SelectionFlag; QFlags<Enum>::Zero = void**] <near match>
         Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
                                 ^~~~~~
    ../../../../include/QtCore/../../src/corelib/global/qglobal.h:2321:29: note:   conversion of argument 1 would be ill-formed:
    itemviews.cpp:396:74: error: invalid conversion from ‘int’ to ‘QFlags<QItemSelectionModel::SelectionFlag>::Zero {aka void**}’ [-fpermissive]
         view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
    In file included from ../../../../include/QtCore/qglobal.h:1:0,
                     from ../../../../include/QtCore/../../src/corelib/global/qnamespace.h:45,
                     from ../../../../include/QtCore/qnamespace.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qobjectdefs.h:45,
                     from ../../../../include/QtCore/qobjectdefs.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qobject.h:47,
                     from ../../../../include/QtCore/qobject.h:1,
                     from ../../../../include/QtCore/../../src/corelib/kernel/qpointer.h:45,
                     from ../../../../include/QtCore/qpointer.h:1,
                     from itemviews.h:45,
                     from itemviews.cpp:42:
    ../../../../include/QtCore/../../src/corelib/global/qglobal.h:2320:29: note: candidate: constexpr QFlags<Enum>::QFlags(Enum) [with Enum = QItemSelectionModel::SelectionFlag] <near match>
         Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {}
                                 ^~~~~~
    ../../../../include/QtCore/../../src/corelib/global/qglobal.h:2320:29: note:   conversion of argument 1 would be ill-formed:
    itemviews.cpp:396:74: error: invalid conversion from ‘int’ to ‘QItemSelectionModel::SelectionFlag’ [-fpermissive]
         view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
    In file included from ../../../../include/QtGui/qitemselectionmodel.h:1:0,
                     from ../../../../include/QtGui/../../src/gui/itemviews/qabstractitemview.h:47,
                     from ../../../../include/QtGui/qabstractitemview.h:1,
                     from itemviews.h:47,
                     from itemviews.cpp:42:
    ../../../../include/QtGui/../../src/gui/itemviews/qitemselectionmodel.h:199:18: note:   initializing argument 2 of ‘virtual void QItemSelectionModel::select(const QModelIndex&, QItemSelectionModel::SelectionFlags)’
         virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
                      ^~~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::State QAccessibleTable2::state(int) const’:
    itemviews.cpp:415:49: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::State QAccessibleTable2::state(int child) const
                                                     ^~~~~
    itemviews.cpp: In member function ‘virtual QString QAccessibleTable2::text(QAccessible::Text, int) const’:
    itemviews.cpp:467:45: warning: unused parameter ‘child’ [-Wunused-parameter]
     QString QAccessibleTable2::text(Text t, int child) const
                                                 ^~~~~
    itemviews.cpp: In member function ‘virtual QRect QAccessibleTable2::rect(int) const’:
    itemviews.cpp:475:35: warning: unused parameter ‘child’ [-Wunused-parameter]
     QRect QAccessibleTable2::rect(int child) const
                                       ^~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::Role QAccessibleTable2Cell::role(int) const’:
    itemviews.cpp:785:51: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::Role QAccessibleTable2Cell::role(int child) const
                                                       ^~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::State QAccessibleTable2Cell::state(int) const’:
    itemviews.cpp:791:53: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::State QAccessibleTable2Cell::state(int child) const
                                                         ^~~~~
    itemviews.cpp: In member function ‘virtual QRect QAccessibleTable2Cell::rect(int) const’:
    itemviews.cpp:837:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
         if (!r.isNull())
         ^~
    itemviews.cpp:839:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
             r.translate(view->mapToGlobal(QPoint(0, 0)));
             ^
    itemviews.cpp:830:39: warning: unused parameter ‘child’ [-Wunused-parameter]
     QRect QAccessibleTable2Cell::rect(int child) const
                                           ^~~~~
    itemviews.cpp: In member function ‘virtual QString QAccessibleTable2Cell::text(QAccessible::Text, int) const’:
    itemviews.cpp:843:49: warning: unused parameter ‘child’ [-Wunused-parameter]
     QString QAccessibleTable2Cell::text(Text t, int child) const
                                                     ^~~~~
    itemviews.cpp: In member function ‘virtual void QAccessibleTable2Cell::setText(QAccessible::Text, int, const QString&)’:
    itemviews.cpp:864:53: warning: unused parameter ‘child’ [-Wunused-parameter]
     void QAccessibleTable2Cell::setText(Text /*t*/, int child, const QString &text)
                                                         ^~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::Relation QAccessibleTable2Cell::relationTo(int, const QAccessibleInterface*, int) const’:
    itemviews.cpp:938:61: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::Relation QAccessibleTable2Cell::relationTo(int child, const QAccessibleInterface *other, int otherChild) const
                                                                 ^~~~~
    itemviews.cpp:938:107: warning: unused parameter ‘otherChild’ [-Wunused-parameter]
     QAccessible::Relation QAccessibleTable2Cell::relationTo(int child, const QAccessibleInterface *other, int otherChild) const
                                                                                                               ^~~~~~~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::Role QAccessibleTable2HeaderCell::role(int) const’:
    itemviews.cpp:977:57: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::Role QAccessibleTable2HeaderCell::role(int child) const
                                                             ^~~~~
    itemviews.cpp: In member function ‘virtual QAccessible::State QAccessibleTable2HeaderCell::state(int) const’:
    itemviews.cpp:985:59: warning: unused parameter ‘child’ [-Wunused-parameter]
     QAccessible::State QAccessibleTable2HeaderCell::state(int child) const
                                                               ^~~~~
    itemviews.cpp: In member function ‘virtual QRect QAccessibleTable2HeaderCell::rect(int) const’:
    itemviews.cpp:991:45: warning: unused parameter ‘child’ [-Wunused-parameter]
     QRect QAccessibleTable2HeaderCell::rect(int child) const
                                                 ^~~~~
    itemviews.cpp: In member function ‘virtual QString QAccessibleTable2HeaderCell::text(QAccessible::Text, int) const’:
    itemviews.cpp:1020:55: warning: unused parameter ‘child’ [-Wunused-parameter]
     QString QAccessibleTable2HeaderCell::text(Text t, int child) const
                                                           ^~~~~
    
    

  • Lifetime Qt Champion

    Hi,

    What exact version of GCC are you using ?

    @nestorac Qt 4.8.7 is the latest and last official version released of the Qt 4 series.



  • gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Debian 6.2.1-5' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
    Thread model: posix
    gcc version 6.2.1 20161124 (Debian 6.2.1-5)

    Regards
    Marek



  • Hi,

    Any hints about why I can't compile 4.8 Qt on Linux x64 ?
    This must be something with gcc version or some kind of flag ???

    Best Regards
    Marek


  • Lifetime Qt Champion

    This version of GCC doesn't allow the conversion from QFlags to int, so just add a static cast and you'll be good to go.



  • Thanks for that hint.

    If anybody needs alternative I put this

    lessThan(QT_MAJOR_VERSION, 5): DEFINES +="_qt4_=1"
    

    inside .pro file and some more

    #ifdef _qt4_
    

    inside .h and .cpp files and my console app compiles with qt4 and qt5

    Best Regards
    Marek


  • Lifetime Qt Champion

    Why re-invent the wheel ? There is already everything you need provided by Qt for such version check.



  • @SGaist could you please elaborate about the cast? I tried (int) and still get an error of "invalid conversion from ‘int’ to ‘QItemSelectionModel::SelectionFlag’ [-fpermissive]"

    If I add -fpermissive to the Makefile's CXXFLAGS, I get an error that the conversion is ambiguous.

    Thank you.



  • Is this the cast you mean? (QItemSelectionModel::SelectionFlag)


  • Lifetime Qt Champion

    No, it's static_cast.



  • in itemviews.cpp, I edited from:

    view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
    

    to:

    view()->selectionModel()->select(index, static_cast<QItemSelectionModel::SelectionFlags>(QItemSelectionModel::Columns & QItemSelectionModel::Deselect));
    

    and at least it compile. Using gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3)



  • @SGaist , @marcelo-banik : Sorry for the late reply to this topic but your cast helped me as well to build Qt 4.8.6 with g++ 7.3.0 so thanks!

    The problem I'm experiencing now are hundreds of warnings from within Qt. Especially stuff from the Q_OBJECT macros and meta system. One popular example is that "register" is deprecated.

    Is there a way to get rid of warnings from within Qt but keep all the warnings for my own code? CONFIG += warn_off in the .pro file does not do the trick. It hides my own warnings as well.


  • Lifetime Qt Champion

    @FrozenTarzan
    Hi
    Ifs the normal compiler warning, im not sure you can disable only for Qt code as
    its actually inserted into your code so there is no difference with compiler warning.
    However, if you code is modern and clean, i assume you could disable some of
    the warning like register keyword as such and not hinder the useful ones for your code.



  • @mrjj Well, that's how I do it right now : - ) I'm usually programming warning-free but I guess that I have to disable those two for now (with g++ 7 and Qt 4.8.6 for embedded):

    -Wno-deprecated-register -Wno-inconsistent-missing-override
    

    Unfortunately, I like the "override" keyword very much but it is very annoying to find the warnings from my code only and it's usually also quite bad to perform a full "warning check" manually once in a while.



  • Ohhh... sorry my newly setup build system utilized clang instead of g++ in QtCreator. Not sure why this is different from all other setups that I have configured in the last time. Maybe it's the preferred one by QtCreator 4.5.
    g++ does not warn about the stuff inside Qt... so I'm "fine" ; - )


Log in to reply