1

I am getting a variety of compilation errors relating to qvariant when compiling my program. I have not modified the Qt libs/source, so why am I getting these errors? (What do they mean)

/Qt/5.9.9/gcc_64/mkspecs/linux-g++ -o tl_ansi_codes.o /mydir/tl_ansi_formatting/tl_ansi_codes.cpp
In file included from /opt/Qt/5.9.9/gcc_64/include/QtCore/qlocale.h:43,
                 from /opt/Qt/5.9.9/gcc_64/include/QtCore/qtextstream.h:46,
                 from /opt/Qt/5.9.9/gcc_64/include/QtCore/qdebug.h:49,
                 from /opt/Qt/5.9.9/gcc_64/include/QtCore/QDebug:1,
                 from /mydir/tl_ansi_formatting/tl_ansi_codes.cpp:9:
/opt/Qt/5.9.9/gcc_64/include/QtCore/qvariant.h: In constructor ‘QVariant::QVariant(QVariant&&)’:
/opt/Qt/5.9.9/gcc_64/include/QtCore/qvariant.h:265:25: warning: implicitly-declared ‘constexpr QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy]
  265 |     { other.d = Private(); }
      |                         ^
/opt/Qt/5.9.9/gcc_64/include/QtCore/qvariant.h:380:16: note: because ‘QVariant::Private’ has user-provided ‘QVariant::Private::Private(const QVariant::Private&)’
  380 |         inline Private(const Private &other) Q_DECL_NOTHROW
      |                ^~~~~~~
g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -Dproject_vls=1 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I/mydir//project -I. -
/opt/Qt/5.9.9/gcc_64/include/QtCore/qvariant.h: In constructor ‘QVariant::QVariant(QVariant&&)’:
/opt/Qt/5.9.9/gcc_64/include/QtCore/qvariant.h:265:25: warning: implicitly-declared ‘constexpr QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy]
  265 |     { other.d = Private(); }
   
TSG
  • 4,242
  • 9
  • 61
  • 121
  • For what it's worth, those are just warnings, not errors. – JarMan Aug 10 '22 at 12:42
  • You're right (I didn't notice that)...but I like a clean compile so I can notice potential problems. I feel like I should be doing something to avoid this warning (other than supressing messages) – TSG Aug 10 '22 at 19:36
  • The warnings appear to come from within Qt code. I'm not positive, but I don't think there's anything you can do to avoid it, other than fix Qt's own code. – JarMan Aug 10 '22 at 20:10

1 Answers1

0

The best solution available is just to ignore it, Or upgrade to qt6. To Ignore the warning, just add

QMAKE_CXXFLAGS += -Wno-deprecated-copy

In all of your .pro files. This will ignore all the deprecated-copy warning; you can also ignore for debug or release build using QMAKE_CXXFLAGS_DEBUG or QMAKE_CXXFLAGS_RELEASE.

halfer
  • 19,824
  • 17
  • 99
  • 186