简体   繁体   English

使用内置 MySQL 库静态构建 Qt

[英]static build of Qt with built-in MySQL library

I am trying to deploy single-file application using MySQL connection with Qt.我正在尝试使用与 Qt 的 MySQL 连接来部署单文件应用程序。 And I discovered that app still depends on libmysql.dll .我发现该应用程序仍然依赖于libmysql.dll That is because even though qt mysql driver plugin is static, it links to dynamic version of library.那是因为即使 qt mysql 驱动程序插件是静态的,它也会链接到库的动态版本。 I tried configuring Qt with both -qt-sql-mysql and -plugin-sql-mysql ,我尝试使用-qt-sql-mysql-plugin-sql-mysql配置 Qt,

Now here's the question: how can I build Qt so mysql library would be built in static qt mysql driver plugin?现在的问题是:如何构建 Qt,以便在静态 qt mysql 驱动程序插件中构建 mysql 库? (or, directly into QtSql ) (或者,直接进入QtSql

Use/build a static version of libmysql (put the *.lib file in Qt's lib folder).使用/构建 libmysql 的静态版本(将 *.lib 文件放在 Qt 的 lib 文件夹中)。

Configure with -qt-sql-mysql is enough.配置 -qt-sql-mysql 就够了。

Make sure that the lib is build with the same compiler/linker.确保使用相同的编译器/链接器构建 lib。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM