回复: 自己写的一个秒表和世界时间表(QT4 开发模式的入门例子)
#11 [limian 04-16 13:35]
make时出现了问题
该怎么解决呢
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `E:/qt/示例/trunk'
g++ -c -g -g -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.2.2/
include/QtCore" -I"C:/Qt/4.2.2/include/QtCore" -I"C:/Qt/4.2.2/include/QtGui" -I"
C:/Qt/4.2.2/include/QtGui" -I"C:/Qt/4.2.2/include" -I"." -I"C:/Qt/4.2.2/include/
ActiveQt" -I"debug" -I"." -I"c:\Qt\4.2.2\mkspecs\win32-g++" -o debug\worldtimer.
o worldtimer.cpp
worldtimer.cpp: In member function `void YWorldTimer::slotSlideWorldTimer(int)':
worldtimer.cpp:160: warning: unused variable 'j'
worldtimer.cpp: In member function `void YWorldTimer::slotStartOneStopWatch()':
worldtimer.cpp:307: error: 'class YStopWatch' has no member named 'setTextStream
'
worldtimer.cpp:318: error: 'class YStopWatch' has no member named 'setTextStream
'
worldtimer.cpp:328: error: 'class YStopWatch' has no member named 'setTextStream
'
mingw32-make[1]: *** Error 1
mingw32-make[1]: Leaving directory `E:/qt/示例/trunk'
mingw32-make: *** Error 2
#12 [htyoung 04-20 10:56]
引用第11楼limian于2007-04-16 13:35发表的 :
make时出现了问题
该怎么解决呢
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `E:/qt/示例/trunk'
...............................................................................
在你的pro文件里有没有这一行:
DEFINES +=WIN_CONFIGURATION EURO_TIME LOG_STOPWATCH
如没有就加入这一行
尤其是 LOG_STOPWATCH 这个开关。因为这个开关是激活 setTextStream()的
如下:
#ifdef LOG_STOPWATCH
void setTextStream(QTextStream * stream);
void writeTimeToTheStream();
#endif
PS:另外 如果你是在windows下开发的话,我强烈建议 你使用 VC 2005 express +QT opensource(它们都是免费的),
因为在windows下VC++ IDE的调试能力要远强于其他的工具。
#13 [hwt23 04-24 23:43]
问一下,怎样把ui文件编译为exe 文件?
#14 [hwt23 04-24 23:55]
用 uic -i form1.h -o form1.cpp form1.ui形式的命令将设计的ui文件生成cpp文件,再将cpp编译成exe文件但是编译出错,没有exe文件生成,是怎么回事?命令行显示如下:
C:\Qt\4.2.3\hwt>make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/4.2.3/hwt'
c:\Qt\4.2.3\bin\uic.exe hwt2.ui -o ui_hwt2.h
g++ -c -g -g -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN_CO
NFIGURATION -DEURO_TIME -DLOG_STOPWATCH -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT
_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.2.3/include/QtCore" -I"C:/Qt/4.2.3/i
nclude/QtCore" -I"C:/Qt/4.2.3/include/QtGui" -I"C:/Qt/4.2.3/include/QtGui" -I"C:
/Qt/4.2.3/include" -I"." -I"C:/Qt/4.2.3/include/ActiveQt" -I"tmp\moc\debug_share
d" -I"." -I"..\mkspecs\win32-g++" -o tmp\obj\debug_shared\hwt2.o hwt2.cpp
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runt
ime-pseudo-reloc -Wl,-subsystem,windows -o "debug\hwt.exe" tmp\obj\debug_shared\
hwt2.o -L"c:\Qt\4.2.3\lib" -L"c:\Qt\4.2.3\lib" -lmingw32 -lqtmaind -lQtGuid4 -l
QtCored4
c:\Qt\4.2.3\lib/libqtmaind.a(qtmain_win.o)(.text+0x30b): In function `WinMain':
C:/Qt/4.2.3/src/winmain/qtmain_win.cpp:105: undefined reference to `qMain(int, c
har**)'
collect2: ld returned 1 exit status
mingw32-make[1]: *** Error 1
mingw32-make[1]: Leaving directory `C:/Qt/4.2.3/hwt'
mingw32-make: *** Error 2
C:\Qt\4.2.3\hwt>
#15 [htyoung 04-25 13:04]
引用第14楼hwt23于2007-04-24 23:55发表的 :
用 uic -i form1.h -o form1.cpp form1.ui形式的命令将设计的ui文件生成cpp文件,再将cpp编译成exe文件但是编译出错,没有exe文件生成,是怎么回事?命令行显示如下:
C:Qt4.2.3hwt>make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/4.2.3/hwt'
c:Qt4.2.3binuic.exe hwt2.ui -o ui_hwt2.h
.......
请注意,在qt4 里尽量不要再用uic 将ui去生成 .cpp 和.h 文件,
如果你想编译这个项目,请直接用使用 stopwatch.pro
如 VC++ express + Qt4:
qmake -tp vc -o stopwatch stopwatch.pro
编译成功后,请仔细看一下code,你会明白 ,为什么不要用uic。因为这样可以保证功能模块和界面模块的很好分离。