- 论坛徽章:
- 0
|
隔了这么长时间,该写写了。学位英语OK了,也进实验室了。没想到上来就搞我最讨厌的GUI开发,用QT。要知道我就是不想做网页才啃底层的阿。说归说,写一个心得,其实是自己太呆的原因。
下了QT4,是编译好的,试试编Hello World可怎么也过不去。错误如下:
C:Qt4.0.0 est1>qmake -project
C:Qt4.0.0 est1>qmake
C:Qt4.0.0 est1>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Qt/4.0.0/test/1'
gcc -c -O2 -O2 -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQ
T_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.0.0/incl
ude/QtGui" -I"C:/Qt/4.0.0/include/QtCore" -I"C:/Qt/4.0.0/include" -I"." -I"C:/Qt
/4.0.0/include/ActiveQt" -I"tmpmocelease_shared" -I"." -I"C:Qt4.0.0mkspecs
win32-g++" -o tmpobjelease_shared est.o test.c
In file included from C:/Qt/4.0.0/include/QtCore/qnamespace.h:1,
from C:/Qt/4.0.0/include/QtCore/../../src/corelib/kernel/qobjec
tdefs.h:27,
from C:/Qt/4.0.0/include/QtCore/qobjectdefs.h:1,
from C:/Qt/4.0.0/include/QtCore/../../src/corelib/kernel/qobjec
t.h:29,
from C:/Qt/4.0.0/include/QtCore/qobject.h:1,
from C:/Qt/4.0.0/include/QtCore/../../src/corelib/kernel/qcorea
pplication.h:27,
from C:/Qt/4.0.0/include/QtCore/qcoreapplication.h:1,
from C:/Qt/4.0.0/include/QtGui/../../src/gui/kernel/qapplicatio
n.h:27,
from C:/Qt/4.0.0/include/QtGui/qapplication.h:1,
from C:/Qt/4.0.0/include/QtGui/QApplication:1,
from test.c:1:
C:/Qt/4.0.0/include/QtCore/../../src/corelib/global/qnamespace.h:31: error: synt
ax error before "Qt"
C:/Qt/4.0.0/include/QtCore/../../src/corelib/global/qnamespace.h:31: error: synt
ax error before '{' token
C:/Qt/4.0.0/include/QtCore/../../src/corelib/global/qnamespace.h:78: warning: re
turn type defaults to `int'
C:/Qt/4.0.0/include/QtCore/../../src/corelib/global/qnamespace.h: In function `Q
_DECLARE_FLAGS':
C:/Qt/4.0.0/include/QtCore/../../src/corelib/global/qnamespace.h:79: error: `Qt'
undeclared (first use in this function)
C:/Qt/4.0.0/include/QtCore/../../src/corelib/global/qnamespace.h:79: error: (Eac
h undeclared identifier is reported only once
C:/Qt/4.0.0/include/QtCore/../../src/corelib/global/qnamespace.h:79: error: for
each function it appears in.)
C:/Qt/4.0.0/include/QtCore/../../src/corelib/global/qnamespace.h:79: confused by
earlier errors, bailing out
mingw32-make[1]: *** [tmpobjelease_shared est.o] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/4.0.0/test/1'
mingw32-make: *** [release] Error 2
开始以为是QT还要从新编译才能用,于是重新编,我考,那个慢阿,一下午也完不了,而且用minGW编的话还出错。于是又改用VC编译,这回连编译都编不了。仔细看了Qmake的Doc,还是没头绪。仔细看原来的错误提示,开始qnamespace.h,看不出有什么问题。又仔细看,怎么是用GCC编的?怪不得不懂namespace,应该是G++才对啊!又找了个原来包里demo是个数字钟。竟然过了。回自己目录又看,才知道自己有多么愚蠢,保存的源文件是.c而不是.cpp。汗阿!!所以Qmake才以为是C程序。改成.cpp后一切OK。
下一步看看Embeded Qt.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4329/showart_35810.html |
|