Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?
-
Hi @BAHRAMUDIN-ADIL,
you can compile Qt yourself with any compiler you like.
The pre-build version is still on MSVC2017 for maximum compatibility. As MSVC2019 is fully compatible with that, you can still use the newer compiler for your apps.
Regards
@aha_1980 Yes I know to compile, but compiling needs its own tools and environment, which not all the users will have it, so it is not a good solution. Why I am asking this? Because I getting an error with MSVC 2019 which is installed in my machine, but the Qt asks me for the 2017 version which I do not have and do not want to have.
-
@aha_1980 Yes I know to compile, but compiling needs its own tools and environment, which not all the users will have it, so it is not a good solution. Why I am asking this? Because I getting an error with MSVC 2019 which is installed in my machine, but the Qt asks me for the 2017 version which I do not have and do not want to have.
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
Because I getting an error with MSVC 2019
Which error exactly?
I'm using Qt 5.14.1/MSVC2017 together with MSVC2019 and that seems to work.
Regards
-
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
Because I getting an error with MSVC 2019
Which error exactly?
I'm using Qt 5.14.1/MSVC2017 together with MSVC2019 and that seems to work.
Regards
@aha_1980 The first thing is the warning which Qt gives me which says: Qt is not compatible with MSVC 2019. OK, this is a warning so skip it.
But the error is I am not able to use MySQL drivers to connect to the database, I have already added the DLL and libs into Qt bin and in my project as well, but still not working and gives error while compiling, and when I switch to another machine which has the same version of Qt but MSVC 2017 installed it works well. Then how to explain this?
Thanks!
-
The Qt Framework is big, has lots of features and modules and classes.
If the new compiler only has marginal changes (like one clang/gcc version to an other) you can rather safely upgrade/support the new version after reading the changelog.
Microsoft until recently, totally broke binary compatibility with each MSVC release and god only knows what they are currently doing.
So upgrading / supporting a new MSVC version will require extensive testing and I assume that's simply not yet done/finished.
I personally already run into Qtmsvc2017 and 2019 incompatibility issues. The Qt support answered me with: Thanks for the report we will look into it, but 2019 is not yet officially supported, we suggest to use 2017.
And that's what I ended up doing.I only used msvc2019 in the first place, because MS makes ist unnecessarily difficult to download older compiler version!😡
What msvc2019 feature is so important that you have to use that compiler ?
gives error while compiling,
what error?
-
The Qt Framework is big, has lots of features and modules and classes.
If the new compiler only has marginal changes (like one clang/gcc version to an other) you can rather safely upgrade/support the new version after reading the changelog.
Microsoft until recently, totally broke binary compatibility with each MSVC release and god only knows what they are currently doing.
So upgrading / supporting a new MSVC version will require extensive testing and I assume that's simply not yet done/finished.
I personally already run into Qtmsvc2017 and 2019 incompatibility issues. The Qt support answered me with: Thanks for the report we will look into it, but 2019 is not yet officially supported, we suggest to use 2017.
And that's what I ended up doing.I only used msvc2019 in the first place, because MS makes ist unnecessarily difficult to download older compiler version!😡
What msvc2019 feature is so important that you have to use that compiler ?
gives error while compiling,
what error?
@J-Hilk Thanks for the explanation. I know it is not an easy job needs a lot of tests, but on the other hand, if you persist to do not support the newer version, then it may cause to lose your users by the time because people they going to use the newer version and leave the older one some of them because of security problem, some of them maybe because of compatibility problem.
You asked me why I want to use MSVC 2019? It is because I am using some libs which recommended to MSVC 2019. And our team development is based on MSVC 2019. -
The Qt Framework is big, has lots of features and modules and classes.
If the new compiler only has marginal changes (like one clang/gcc version to an other) you can rather safely upgrade/support the new version after reading the changelog.
Microsoft until recently, totally broke binary compatibility with each MSVC release and god only knows what they are currently doing.
So upgrading / supporting a new MSVC version will require extensive testing and I assume that's simply not yet done/finished.
I personally already run into Qtmsvc2017 and 2019 incompatibility issues. The Qt support answered me with: Thanks for the report we will look into it, but 2019 is not yet officially supported, we suggest to use 2017.
And that's what I ended up doing.I only used msvc2019 in the first place, because MS makes ist unnecessarily difficult to download older compiler version!😡
What msvc2019 feature is so important that you have to use that compiler ?
gives error while compiling,
what error?
@J-Hilk One problem I am getting while using Qt with MSVC 2019, my code not getting compiled:
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QSqlDatabase::~QSqlDatabase(void)" (__imp_??1QSqlDatabase@@QEAA@XZ) referenced in function main
But same code works well with Qt + MSVC 2017.
-
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
But same code works well with Qt + MSVC 2017.
I doubt that - I would guess you don't link against the Qt sql library. Please show us your .pro file and/or make sure you're linking against the correct libraries you need.
-
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
But same code works well with Qt + MSVC 2017.
I doubt that - I would guess you don't link against the Qt sql library. Please show us your .pro file and/or make sure you're linking against the correct libraries you need.
@Christian-Ehrlicher It is the .pro file content:
QT -= gui CONFIG += c++11 console sql CONFIG -= app_bundle # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
I have all the DLL and libs files in the Qt installed location bin/lib folder.
-
According to the documentation (https://doc.qt.io/qt-5/qsqldatabase.html) you should add
QT += sql
to your .pro file. This tells the compiler to link with the SQL plugin.
-
According to the documentation (https://doc.qt.io/qt-5/qsqldatabase.html) you should add
QT += sql
to your .pro file. This tells the compiler to link with the SQL plugin.
@SimonSchroeder Thanks! I will try it.
-
@SimonSchroeder Thanks! I will try it.
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
@SimonSchroeder If you see carefully I have already added sql
To the wrong variable. You added it to
CONFIG
but you shall add it toQT
as @SimonSchroeder wrote.[edit: Answer to the original post SGaist]
-
According to the documentation (https://doc.qt.io/qt-5/qsqldatabase.html) you should add
QT += sql
to your .pro file. This tells the compiler to link with the SQL plugin.
@SimonSchroeder Yes, I did not add the SQL module correctly in .pro file. But now I got this error:
QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
-
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
@SimonSchroeder If you see carefully I have already added sql
To the wrong variable. You added it to
CONFIG
but you shall add it toQT
as @SimonSchroeder wrote.[edit: Answer to the original post SGaist]
@SGaist Hmmm, yes, it was my fault, but now I got the next error, what is your opinion?
I have already added these two DLL files in Qt bin directory:libmysqld.dll libmysql.dll
And also I have tried these three as well:
ssleay32.dll libeay32.dll libmysql.lib
Also not solved the problem.
-
@SimonSchroeder Yes, I did not add the SQL module correctly in .pro file. But now I got this error:
QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
@BAHRAMUDIN-ADIL
after modifying your pro file, ALWAYS clean and run qmakeyou added a new module so I would go a step further and delete the build directory for a complete rebuild
-
@BAHRAMUDIN-ADIL
after modifying your pro file, ALWAYS clean and run qmakeyou added a new module so I would go a step further and delete the build directory for a complete rebuild
@J-Hilk Yes, I did that as you said, but the problem still exists. Can you tell me what files and libs I need to add and add them in which place? Thanks!
-
@SimonSchroeder Yes, I did not add the SQL module correctly in .pro file. But now I got this error:
QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7As you can see from the listing, you don't have the plugin at all.
As for why: the licensing of MySQL changed so only GPL and Commercial are available now. Since the pre-built binaries are usable also under the LGPL, the plugin can't be provided.
You also have the option of building it with MariaDB which fixes the licensing issue.
See QTBUG-78241
-
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7As you can see from the listing, you don't have the plugin at all.
As for why: the licensing of MySQL changed so only GPL and Commercial are available now. Since the pre-built binaries are usable also under the LGPL, the plugin can't be provided.
You also have the option of building it with MariaDB which fixes the licensing issue.
See QTBUG-78241
@SGaist You mean that I need to build Qt from source with the needed plugins? Or I just need to build the MySQL plugin? If the second case is right, then to build the only plugin, what should I need, and how to build? Is there any guide to show how to build?
Thanks! -
@SGaist You mean that I need to build Qt from source with the needed plugins? Or I just need to build the MySQL plugin? If the second case is right, then to build the only plugin, what should I need, and how to build? Is there any guide to show how to build?
Thanks!you need to build the plugin as described here: https://doc.qt.io/qt-5/sql-driver.html#qmysql
Regards
-
you need to build the plugin as described here: https://doc.qt.io/qt-5/sql-driver.html#qmysql
Regards
@aha_1980 Yes, before you send me the answer I saw this documentation, but can you tell me where is it?
cd %QTDIR%\qtbase\src\plugins\sqldrivers
I did not find in whole Qt installation directory.
Thank you so much!!!
-
@BAHRAMUDIN-ADIL said in Qt already updated to 5.14.1, but why it still uses MSVC 2017 build tools?:
I did not find in whole Qt installation directory.
As you can see there is 'src' - you need the Qt sources...