Qt用MSVC19编译器构建MYSQL驱动程序

fdbelqdn  于 2022-10-31  发布在  Mysql
关注(0)|答案(1)|浏览(136)

我试图用MSVC 2019编译器构建MYSQL驱动程序,但没有成功。我已经检查了所有不同的指令,包括Qt Docs,但都是徒劳的。我以前为MinGW构建过驱动程序,没有遇到麻烦,而且我机器上所有用MinGW作为编译器的项目都连接到MYSQL数据库。现在这个新项目要求我使用用MSVC编译的DLL,特别是要求我使用MSVC 32位。以下是控制台的输出


**********************************************************************
**Visual Studio 2022 Developer Command Prompt v17.2.5
**Copyright (c) 2022 Microsoft Corporation
**********************************************************************

[vcvarsall.bat] Environment initialized for: 'x86'

C:\Program Files\Microsoft Visual Studio\2022\Community>C:\Qt\5.15.2\msvc2019\bin\qtenv2.bat
Setting up environment for Qt usage...
Remember to call vcvarsall.bat to complete environment setup!

C:\Qt\5.15.2\msvc2019>cd C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers

C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="D:/Qt/Apps/connectors/mysql-connector-c-6.1.11-win32/include" MYSQL_LIBDIR="D:/Qt/Apps/connectors/mysql-connector-c-6.1.11-win32/lib"

Running configuration tests...
Done running configuration tests.

Configure summary:

Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite2 ................................ no
  SQLite ................................. yes
    Using system provided SQLite ......... no
  TDS (Sybase) ........................... no

Qt is now configured for building. Just run 'nmake'.
Once everything is built, you must run 'nmake install'.
Qt will be installed into 'C:\Qt\5.15.2\msvc2019'.

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers>nmake

Microsoft (R) Program Maintenance Utility Version 14.32.31332.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        cd sqlite\ && ( if not exist Makefile C:\Qt\5.15.2\msvc2019\bin\qmake.exe -o Makefile C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers\sqlite\sqlite.pro ) && "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86\nmake.exe" -f Makefile

Microsoft (R) Program Maintenance Utility Version 14.32.31332.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86\nmake.exe" -f Makefile.Release

Microsoft (R) Program Maintenance Utility Version 14.32.31332.0
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers>nmake sub-mysql

Microsoft (R) Program Maintenance Utility Version 14.32.31332.0
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE: fatal error U1073: don't know how to make 'sub-mysql'
Stop.

C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers>

我还在配置文件中发现了一些错误:
项目错误:已加载msvc-version.conf,但未设置QMAKE_MSC_VER。

dtcbnfnu

dtcbnfnu1#

CodeMonkey68为MYSQL here构建了几乎所有的驱动程序,Gan创建了一个video,解释了如何使用这些驱动程序。我使用了他的说明,我能够使用MSVC 2019 32位和64位连接到数据库。这是一个了解您的编译器/工具包的版本,然后从网站下载正确的驱动程序的问题。

相关问题