我想在Qt中創建一個依賴MySql的應用程序。一段時間後,我開始知道我的共享內部版本沒有MySql驅動程序(默認情況下)。任何人都可以說如何獲得它(共享和靜態)。Qt - 如何獲取|編譯Mysql驅動程序
注:我用的Qt 4.7.2在Windows平臺
編輯: 感謝 「vrince」。這是他展示的方式=>我做過的。
1)Open qt-command prompt
2)Goto (Qt's installation path)\qt\src\plugins\sqldrivers\mysql
in my case:
D:\TempInstallationFolder\Qt\dynamic-New\qt\src\plugins\sqldrivers\mysql
3)qmake
4)make
or
mingw32-make (provided your PATH variable contains "(Qt installation path)\mingw\bin")
("make" should work if you didn't mess up with path variables. It in turn
invokes mingw32-make. I messed up this a little bit. So I invoked
mingw32-make directly.)
5)In the above command you have to indicate the mysql's "lib" path,
and "include" path through the compile flag options. Or Add those lines
in the pro file like below
INCLUDEPATH += "C:\Program Files\MySQL\MySQL Server 5.1\include"
LIBS += -L"C:\Program Files\MySQL\MySQL Server 5.1\lib\opt"
就是這樣。你可以在 (Qt-安裝路徑)\ qt \ plugins \ sqldrivers中找到dll