在Windows XP下编译Qt4,运行configure.exe一切正常,mingw32-make后,出现如下严重错误:
styles/qwindowsxpstyle.cpp:3677: warning: unused variable 'dwOpt'
mingw32-make[2]: *** [tmp/obj/debug_shared/qwindowsxpstyle.o] Error 1
mingw32-make[2]: Leaving directory `C:/Qt/4.0.0src/gui'
mingw32-make[1]: *** [debug] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.0.0/src/gui'
mingw32-make: *** [debug-gui] Error 2
在网上google到了一些资料,说是系统中找不到windowsxp的窗体式样的sdk,然后安装了Microsoft Windows SDK,并加入到系统变量中,还是没有解决问题。
然后尝试着通过编辑styles.pri注释掉windowsxp style:
#contains( styles, windowsxp ) {
# HEADERS += styles/qwindowsxpstyle.h
# SOURCES += styles/qwindowsxpstyle.cpp
# !contains( styles, windows ) {
# message( windowsxp requires windows )
# styles += windows
# DEFINES+= QT_STYLE_WINDOWS
# }
#} else {
DEFINES += QT_NO_STYLE_WINDOWSXP
#}
虽然这次重新编译后,原有的问题确实解决了,然后又出现了新的问题,导致make没能成功。
最后,参考了configure.exe -help得出的解决途径,相当简单,使用configure.exe时增加-no-style-windowsxp即可。即:configure.exe -no-style-windowsxp,然后make成功。