• 6586阅读
  • 9回复

QT GUIprogramming 的重大疑问,新手求救 [复制链接]

上一主题 下一主题
离线lee520
 
只看楼主 正序阅读 楼主  发表于: 2009-12-07
QT GUIprogramming 为何使用Qt Creator可以编译通过,而手动编译,make时却出现错误呢?是不是环境变量的问题?请高人指点下,新手入门,虚心求教,勿喷。。。。

错误如下:
C:\Documents and Settings\pengli\My Documents\first>qmake -project

C:\Documents and Settings\pengli\My Documents\first>qmake first.pro

C:\Documents and Settings\pengli\My Documents\first>mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/pengli/My Documen
ts/first'
Makefile.Debug:58: *** missing separator.  Stop.
mingw32-make[1]: Leaving directory `C:/Documents and Settings/pengli/My Document
s/first'
mingw32-make: *** [debug] Error 2
离线wd007

只看该作者 9楼 发表于: 2009-12-07
不要这么自责,这个问题还是比较典型的。大家在开始时,很多人都会有这样那样的错误。
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
离线lee520
只看该作者 8楼 发表于: 2009-12-07
我承认我真是个傻x,在在改过环境变量之后就已经成功了。编译成功了已经在debug里生成了个exe
我没注意得到,感谢楼上诸位仁兄的鼎力相助,新手上路对Qt还不是很熟悉,见笑了
离线lee520
只看该作者 7楼 发表于: 2009-12-07
QTDIR错了,改成QTDIT D:\Qt\2009.05
C:\Documents and Settings\pengli\My Documents\hello>mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/pengli/My Documen
ts/hello'
mingw32-make[1]: Nothing to be done for `first'.
mingw32-make[1]: Leaving directory `C:/Documents and Settings/pengli/My Document
s/hello'
离线lee520
只看该作者 6楼 发表于: 2009-12-07
将 QMAKESPEC win32-msvc 删除掉编译结果是。。。
D:\hello>mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `D:/hello'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\Qt
\2009.05\qt\include\QtCore" -I"..\Qt\2009.05\qt\include\QtGui" -I"..\Qt\2009.05\
qt\include" -I"." -I"..\Qt\2009.05\qt\include\ActiveQt" -I"debug" -I"..\Qt\2009.
05\qt\mkspecs\default" -o debug\hello.o hello.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o debug\hello.exe debug/hello.o  -L"d:\
Qt\2009.05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `D:/hello'

代码是qt GUI的
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->show();
return app.exec();
}

环境变量:
path D:\Qt\2009.05\qt\bin;D:\Qt\2009.05\mingw\bin
QTDIR D:\Qt
离线lee520
只看该作者 5楼 发表于: 2009-12-07
尝试了您说的两种方法。。。
出现了这个问题。。
C:\Documents and Settings\pengli\My Documents\hello>mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/pengli/My Documen
ts/hello'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\Qt
\2009.05\qt\include\QtCore" -I"d:\Qt\2009.05\qt\include\QtGui" -I"d:\Qt\2009.05\
qt\include" -I"." -I"d:\Qt\2009.05\qt\include\ActiveQt" -I"debug" -I"d:\Qt\2009.
05\qt\mkspecs\win32-g++" -o debug\hello.o hello.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o debug\hello.exe debug/hello.o  -L"d:\
Qt\2009.05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `C:/Documents and Settings/pengli/My Document
s/hello'
离线tieqilin
只看该作者 4楼 发表于: 2009-12-07
删掉 QMAKESPEC win32-msvc
离线dbzhang800

只看该作者 3楼 发表于: 2009-12-07
删掉 QMAKESPEC win32-msvc

或改为

win32-g++
离线lee520
只看该作者 2楼 发表于: 2009-12-07
我试了一次,但是还是失败了,依然是这个错误,这个问题和环境变量有关系么?
环境变量,我只是按照网上说的,加了个QTDIR D:\Qt和 QMAKESPEC win32-msvc在path 中加了D:\Qt\2009.05\bin;D:\Qt\2009.05\mingw\bin
离线yb824
只看该作者 1楼 发表于: 2009-12-07
把你first拷到c盘根目录试下
快速回复
限100 字节
 
上一个 下一个