Qt 5 project won't compile in Qt 6 despite core5compat and QT_DISABLE_DEPRECATED_BEFORE

41 Views Asked by At

My computer has recently undergone a fresh install on Debian 12 after some mayhem in updating Ubuntu. I reinstalled Qt Creator and Qt6.6. I opened several old projects that used to work under Qt5.something (I think it was 5.15 but I have no way to verify it) on my previous installation 2 weeks ago. When trying to build them with qmake, they would not compile anymore and throw hundreds of errors, all with undefined references to core libraries including QByteArray, QDateTime, QString...

After Googleing the problem, I downloaded the Qt5 compatibility module via Qt Manager and I proceeded to add QT += core5compat to my .pro and try with or without DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00 and with C++11 or C++17

This hasn't change the outcome. Am I missing something ?

Typical errors that are fired during the compilation (in this case, we're talking 1030 errors on a 500 lines code, non in the code itself) look like

:-1: error: /home/pathToProjects/ScarTest/../build/simbaLib/Desktop/Debug/libsimbaLib.a(crc8message.o): in function `CRC8Message::basecmd()':
/home/pathToProjects/simbaLib/crc8message.cpp:11: error: undefined reference to `QByteArray::QByteArray(char const*, int)'
:-1: error: /home/pathToProjects/ScarTest/../build/simbaLib/Desktop/Debug/libsimbaLib.a(crc8message.o): in function `QArrayData::sharedNull()':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:122: error: undefined reference to `QArrayData::shared_null'
:-1: error: /home/pathToProjects/ScarTest/../build/simbaLib/Desktop/Debug/libsimbaLib.a(crc8message.o): in function `QByteArray::detach()':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:501: error: undefined reference to `QByteArray::reallocData(unsigned int, QFlags<QArrayData::AllocationOption>)'
:-1: error: /home/pathToProjects/ScarTest/../build/simbaLib/Desktop/Debug/libsimbaLib.a(crc8message.o): in function `QByteRef::operator=(char)':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:542: error: undefined reference to `QByteArray::expand(int)'
:-1: error: /home/pathToProjects/ScarTest/../build/simbaLib/Desktop/Debug/libsimbaLib.a(crc8message.o): in function `QTypedArrayData<char>::deallocate(QArrayData*)':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:228: error: undefined reference to `QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
:-1: error: /home/pathToProjects/ScarTest/../build/simbaLib/Desktop/Debug/libsimbaLib.a(qftp.o): in function `QFtpDTP::read(char*, long long)':
/home/pathToProjects/simbaLib/qftp.cpp:376: error: undefined reference to `QByteArray::remove(int, int)'
0

There are 0 best solutions below