• 9293阅读
  • 3回复

windows qt4.3.3 mysql5.0 编译mysql驱动遇到了问题 [复制链接]

上一主题 下一主题
离线senfrans
 

只看楼主 倒序阅读 楼主  发表于: 2008-06-28
— 本帖被 XChinux 执行加亮操作(2008-06-28) —
按照  “ Qt4 OpenSource for mingw中编译MySQL驱动 ”  这个帖子
http://www.qtcn.org/bbs/read.php?tid=4210

编译mysql驱动  make 不了

出现下面的错误:


E:\Qt\4.3.3\src\plugins\sqldrivers\mysql>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `E:/Qt/4.3.3/src/plugins/sqldrivers/mysql'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
-DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -
I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\inclu
de\QtSql" -I"..\..\..\..\include" -I"INCLUDEPATH+=E:\MYSQL\INCLUDE" -I"LIBS+=E:\
MYSQL\LIB\OPT\LIBMYSQL.a" -I"mysql.pro" -I"e:\Qt\4.3.3\include\ActiveQt" -I"tmp\
moc\release_shared" -I"." -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\release_s
hared\main.o main.cpp
cc1plus.exe: mysql.pro: not a directory
mingw32-make[1]: *** [tmp/obj/release_shared/main.o] Error 1
mingw32-make[1]: Leaving directory `E:/Qt/4.3.3/src/plugins/sqldrivers/mysql'
mingw32-make: *** [release] Error 2

请达人帮忙啊
离线senfrans

只看该作者 1楼 发表于: 2008-06-28
先把mysql5 中的include 和lib 复制到了 mysql目录下的
保证后面qmake 时找到include 和libmysql.a

cd c:\mysql\lib\opt
reimp -d libmysql.lib
dlltool -k -d libmysql.def -l libmysql.a

  cd %QTDIR%\src\plugins\sqldrivers\mysql
  qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.a" mysql.pro
  make

然后就出现了以上的错误

离线wd007

只看该作者 2楼 发表于: 2008-12-13
未遇到过,同问
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
离线sophister
只看该作者 3楼 发表于: 2009-03-28
D:\Qt\QtCreator\qt\src\plugins\sqldrivers\mysql>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `D:/Qt/QtCreator/qt/src/plugins/sqldrivers/m
ysql'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
-DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"d:\Qt\4.3.2\include\QtCore" -
I"d:\Qt\4.3.2\include\QtCore" -I"d:\Qt\4.3.2\include\QtSql" -I"d:\Qt\4.3.2\inclu
de\QtSql" -I"d:\Qt\4.3.2\include" -I"c:\MYSQL\INCLUDE" -I"d:\Qt\4.3.2\include\Ac
tiveQt" -I"release" -I"." -I"d:\Qt\4.3.2\mkspecs\default" -o release\main.o main
.cpp
In file included from main.cpp:40:
../../../sql/drivers/mysql/qsql_mysql.h:60: error: expected constructor, destruc
tor, or type conversion before "class"
../../../sql/drivers/mysql/qsql_mysql.h:128: error: ISO C++ forbids declaration
of `QMYSQLDriverPrivate' with no type
../../../sql/drivers/mysql/qsql_mysql.h:128: error: expected `;' before '*' toke
n
../../../sql/drivers/mysql/qsql_mysql.h:131: error: `QT_END_NAMESPACE' does not
name a type
main.cpp:53: error: `QMYSQLDriverPlugin' has not been declared
main.cpp:54: error: ISO C++ forbids declaration of `QMYSQLDriverPlugin' with no
type
main.cpp: In function `int QMYSQLDriverPlugin()':
main.cpp:54: error: only constructors take base initializers
main.cpp: At global scope:
main.cpp:58: error: `QMYSQLDriverPlugin' is not a class or namespace
main.cpp:67: error: `QMYSQLDriverPlugin' is not a class or namespace
main.cpp:68: error: non-member function `QStringList keys()' cannot have `const'
method qualifier
main.cpp: In function `QObject* qt_plugin_instance()':
main.cpp:76: error: `QMYSQLDriverPlugin' is not a type
main.cpp: At global scope:
main.cpp:78: error: expected constructor, destructor, or type conversion at end
of input
mingw32-make[1]: *** [release\main.o] Error 1
mingw32-make[1]: Leaving directory `D:/Qt/QtCreator/qt/src/plugins/sqldrivers/my
sql'
mingw32-make: *** [release] Error 2

D:\Qt\QtCreator\qt\src\plugins\sqldrivers\mysql>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `D:/Qt/QtCreator/qt/src/plugins/sqldrivers/m
ysql'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
-DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"d:\Qt\4.3.2\include\QtCore" -
I"d:\Qt\4.3.2\include\QtCore" -I"d:\Qt\4.3.2\include\QtSql" -I"d:\Qt\4.3.2\inclu
de\QtSql" -I"d:\Qt\4.3.2\include" -I"c:\MYSQL\INCLUDE" -I"d:\Qt\4.3.2\include\Ac
tiveQt" -I"release" -I"." -I"d:\Qt\4.3.2\mkspecs\default" -o release\main.o main
.cpp
In file included from main.cpp:40:
../../../sql/drivers/mysql/qsql_mysql.h:60: error: expected constructor, destruc
tor, or type conversion before "class"
../../../sql/drivers/mysql/qsql_mysql.h:128: error: ISO C++ forbids declaration
of `QMYSQLDriverPrivate' with no type
../../../sql/drivers/mysql/qsql_mysql.h:128: error: expected `;' before '*' toke
n
../../../sql/drivers/mysql/qsql_mysql.h:131: error: `QT_END_NAMESPACE' does not
name a type
main.cpp:53: error: `QMYSQLDriverPlugin' has not been declared
main.cpp:54: error: ISO C++ forbids declaration of `QMYSQLDriverPlugin' with no
type
main.cpp: In function `int QMYSQLDriverPlugin()':
main.cpp:54: error: only constructors take base initializers
main.cpp: At global scope:
main.cpp:58: error: `QMYSQLDriverPlugin' is not a class or namespace
main.cpp:67: error: `QMYSQLDriverPlugin' is not a class or namespace
main.cpp:68: error: non-member function `QStringList keys()' cannot have `const'
method qualifier
main.cpp: In function `QObject* qt_plugin_instance()':
main.cpp:76: error: `QMYSQLDriverPlugin' is not a type
main.cpp: At global scope:
main.cpp:78: error: expected constructor, destructor, or type conversion at end
of input
mingw32-make[1]: *** [release\main.o] Error 1
mingw32-make[1]: Leaving directory `D:/Qt/QtCreator/qt/src/plugins/sqldrivers/my
sql'
mingw32-make: *** [release] Error 2

D:\Qt\QtCreator\qt\src\plugins\sqldrivers\mysql>
快速回复
限100 字节
 
上一个 下一个