Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. error: QSqlDatabase: No such file or directory
Forum Updated to NodeBB v4.3 + New Features

error: QSqlDatabase: No such file or directory

Scheduled Pinned Locked Moved Unsolved Qt 6
2 Posts 1 Posters 740 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Navadvipa Chandra das
    wrote on last edited by
    #1

    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.

    N 1 Reply Last reply
    0
    • N Navadvipa Chandra das

      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.

      N Offline
      N Offline
      Navadvipa Chandra das
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved