error: QSqlDatabase: No such file or directory
-
Hello, All!
Compiled Qt6 from source codes (obtained only in release mode), then compiled QtCreator in release mode. QtCreator started, but at the same time I added a value to the path system variable C:\QtSource\Release\Lib\bin .
Just a project with an empty window compiled and started well. Only the debugger swore that you have a Python version 0.0, and you need either 2.7 or 3 and higher. Although I have Python version 3.11 . But when I tried to add work with databases, I got an error C:\QtPrg\PrabhupadaDictionary\QPrabhupada.h:5 : error: QSqlDatabase: No such file or directory
In file included from C:/QtPrg/PrabhupadaDictionary/QPrabhupada.cpp:1:
C:/QtPrg/PrabhupadaDictionary/QPrabhupada.h:5:10: fatal error: QSqlDatabase: No such file or directory
5 | #include <QSqlDatabase>
| ^~~~~~~~~~~~~~
Although there is such a file in the folder C:\QtSource\Release\Lib\include\QtSql
Qt6sql was not shown in QtCreator in the "CMake Modules" tree
, I fixed the file CMakeList.txt
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools Sql)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools Sql)I added Sql. Qt6Sql appeared in "CMake Modules", but it didn't help! How do I properly post the file so that the file is located by the compiler?
Thank you!
Sincerely, Navadvipa Chandra das. -
Hello, All!
I add Sql to this line:
target_link_libraries(PrabhupadaDictionary PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql)And this problem disappeared. Others appeared. Thanks! I will continue to correct the program "Srila Prabhupada's Dictionary", which was originally written in CopperSpice.
Thank You very much!
With best regards, NavadvipaChandra das.