Can't compile Qt 4.8.7
-
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 -
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)
-
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.
-
@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" ; - )