用于 Qt 4.8.0 构建的 MySQL 插件失败 [英] MySQL plugin for Qt 4.8.0 build fails

查看:54
本文介绍了用于 Qt 4.8.0 构建的 MySQL 插件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 Qt 项目构建 MySQL 插件.我正在按照其他地方给出的说明进行操作,但似乎 qmake 生成的 makefile 有错误,并且 nmake 生成 DLL 失败.

I am trying to build the MySQL plugin for a Qt project. I am following the instructions given elsewhere, but it appears that the makefile which is generated by qmake has an error and the nmake to generate the DLL fails.

有人有替代程序吗?

有谁知道为什么我们不能为此下载 MySQL DLL?为什么每个人都必须构建它?

And does anyone know why we simply can't download the MySQL DLL for this? Why does everybody have to build it?

流程如下;

qmake "INCLUDEPATH+=c:/'Program Files'/MySQL/'Connector C 6.0.2'/include" "LIBS+=-Lc:/'Program Files'/MySQL/'Connector C 6.0.2'/lib/debug " mysql.pro

c:\QtSDK\QtSources\4.8.0\src\plugins\sqldrivers\mysql>nmake debug

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.
    "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe" -f Makefile.Debug

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01

Copyright (C) Microsoft Corporation.  All rights reserved.

    rc -D_DEBUG -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3
DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -fo debug\qsqlmysqld_resource.res qsqlmysqld_resource.rc

'rc' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'rc' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"' : return code '0x2'
Stop.

推荐答案

虽然我用 nmake 解决了构建插件的问题,但没有得到 Qt 识别的插件.

While I solved the problem of building the plugin with nmake, it didn't result in a plugin that Qt recognized.

相反,我使用 QtCreator 和项目文件构建了插件(您的 Qt 源文件夹路径/src/plugins/sqldrivers/mysql

Instead I built the plugins using QtCreator and the project file included in (Your Qt source folder path/src/plugins/sqldrivers/mysql

必须编辑 .pro 文件,以便包含和 lib 路径与您的 MySQL 安装匹配..pro 文件中的条目在路径中包含空格,但这并没有建立.我必须从 mysql 路径中取出所有空格才能构建它.我将 MySQL 从Program Files (x86)"拖到 C: 并从文件夹名称中删除了空格.

The .pro file has to be edited so that the include and lib paths match that for your MySQL install. The entries that were in the .pro file included spaces in the paths, but this did not build. I had to take all spaces out of the mysql paths to get it to build. I dragged MySQL out of the "Program Files (x86)" to C: and removed spaces from the folder names.

接下来,调试版本指定-llibmysqld,它似乎不再存在.我将其更改为 -llibmysql(与发行版相同),然后两个 dll 都构建良好.

Next, the debug build specifies -llibmysqld which doesn't seem to exist anymore. I changed it to -llibmysql (same as the release) and then both dlls built fine.

我使用了 Qt Creator 2.6.2、Qt 4.8.4.生成的 dll 正在与构建的 Qt 项目一起使用在 Visual Studio 2010 和 Windows 7 下.

I used Qt Creator 2.6.2, Qt 4.8.4. The resulting dlls are working with Qt projects built under Visual Studio 2010 and Windows 7.

这篇关于用于 Qt 4.8.0 构建的 MySQL 插件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆