以前从
http://get.qt.nokia.com/qtsdk/qt-sdk-win-opensource-2009.03.exe 下载的QT SDK安装包,安装到D:\Qt以后,执行QtCreator,随便打开一个示例工程来编译,都显示大片类似以下的错误:
Running build steps for project configdialog...
Starting: D:/Qt/2009.03/qt/bin/qmake.exe D:/Qt/2009.03/qt/examples/dialogs/configdialog/configdialog.pro -spec win32-g++ -r
Exited with code 0.
Starting: D:/Qt/2009.03/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `D:/Qt/2009.03/qt/examples/dialogs/configdialog'
D:/Qt/2009.03/mingw/bin/mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `D:/Qt/2009.03/qt/examples/dialogs/configdialog'
g++ -c -g -Wall -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -
I"d:\Qt\4.5.2-msvc2008\include\QtCore" -I"d:\Qt\4.5.2-msvc2008\include\QtGui" -I"d:\Qt\4.5.2-msvc2008\include" -I"." -I"d:\Qt\4.5.2-msvc2008\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\configdialog.o configdialog.cpp
configdialog.cpp:42:17: QtGui: No such file or directory
In file included from configdialog.cpp:44:
configdialog.h:45:19: QDialog: No such file or directory
In file included from configdialog.cpp:44:
configdialog.h:48: error: expected constructor, destructor, or type conversion before "class"
configdialog.h:53: error: expected constructor, destructor, or type conversion before "class"
In file included from configdialog.cpp:45:
pages.h:45:19: QWidget: No such file or directory
In file included from configdialog.cpp:45:
pages.h:48: error: expected class-name before '{' token
pages.h:50: error: expected `)' before '*' token
pages.h:54: error: expected class-name before '{' token
pages.h:56: error: expected `)' before '*' token
pages.h:60: error: expected class-name before '{' token
pages.h:62: error: expected `)' before '*' token
configdialog.cpp:47: error: `ConfigDialog' has not been declared
configdialog.cpp:48: error: ISO C++ forbids declaration of `ConfigDialog' with no type
configdialog.cpp: In function `int ConfigDialog()':
configdialog.cpp:49: error: `contentsWidget' was not declared in this scope
configdialog.cpp:49: error: `QListWidget' has not been declared
configdialog.cpp:50: error: `QListView' has not been declared
configdialog.cpp:50: error: `IconMode' was not declared in this scope
configdialog.cpp:51: error: `QSize' was not declared in this scope
configdialog.cpp:52: error: `QListView' has not been declared
configdialog.cpp:52: error: `Static' was not declared in this scope
configdialog.cpp:56: error: `pagesWidget' was not declared in this scope
(省略N行)
mingw32-make[1]: Leaving directory `D:/Qt/2009.03/qt/examples/dialogs/configdialog'
mingw32-make: Leaving directory `D:/Qt/2009.03/qt/examples/dialogs/configdialog'
mingw32-make[1]: *** [tmp/obj/debug_shared/configdialog.o] Error 1
mingw32-make: *** [debug-all] Error 2
Exited with code 2.
Error while building project configdialog
When executing build step 'Make'
注意到我标出的红色部分:
d:\Qt\4.5.2-msvc2008\ 这是我以前并行安装过的另一个版本,正常使用过。
但后来系统出问题,我用GHOST恢复了一个系统盘的备份,回到了没有安装过任何QT版本的状态。
然后删除了D:\Qt目录中所有内容,再重装安装 qt-sdk-win-opensource-2009.03.exe,结果连示例工程也编译不了。
改用 Qt Command Prompt 下来编译,甚至提示:
D:\Qt\2009.03\qt\examples\dialogs\configdialog>make
'make' 不是内部或外部命令,也不是可运行的程序或批处理文件。一看PATH路径中都没有 make.* 了,于是复制 mingw32-make.exe 为 make.exe,再编译,OK!
中到 Qt Creator 中编译,也OK!
这可有点奇怪了。