【发布时间】:2010-11-23 23:51:33
【问题描述】:
我正在尝试构建 qtestlib/tutorial1 示例,但是当我运行 nmake 时没有生成 testqstring.moc 文件(我是在 Windows XP SP3 上运行 Qt 4.5.2)。
我将 testqstring.cpp 从教程目录复制到我的构建目录 (C:\sandboxes\testqstring) 并从 Qt 命令提示符运行我的 MS Visual 中的 vsvars32.bat 文件安装 Studio 8 以添加 VS 环境变量。
根据教程,我应该运行:
> qmake -project "CONFIG += qtestlib"
> qmake
> nmake
当我这样做时,nmake 的输出是:
C:/Apps/Qt/2009.03/qt/bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_TESTLIB_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"....\Apps\Qt\2009.03\qt\include \QtCore" -I"....\Apps\Qt\2009.03\qt\include\QtGui" -I"....\Apps\Qt\2009.03\qt\include\QtTest" -I".... \Apps\Qt\2009.03\qt\include"-I"." -I"....\Apps\Qt\2009.03\qt\include\ActiveQt" -I"调试" -I"....\Apps\Qt\2009.03\qt\mkspecs\win32-g++" -D__GNUC__ - DWIN32 testqstring.cpp -o debug\testqstring.moc
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_TESTLIB_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"....\Apps\Qt\2009.03\qt\include\QtCore" -I"....\Apps\Qt\2009.03\qt\include\QtGui" -I"....\Apps\Qt\2009.03\qt\include\QtTest" -I"....\Apps\ Qt\2009.03\qt\include"-I"." -I"....\Apps\Qt\2009.03\qt\include\ActiveQt" -I"调试" -I"....\Apps\Qt\2009.03\qt\mkspecs\win32-g++" -o 调试\testqstring.o testqstring.cpp
testqstring.cpp:63:27: testqstring.moc: 没有这样的文件或目录
NMAKE:致命错误 U1077:'C:\Apps\Qt\2009.03\mingw\bin\g++.EXE':返回码 '0x1' 停止。
NMAKE:致命错误 U1077:'C:\PROGRA~1\MICROS~3\VC\BIN\nmake.exe':返回代码 '0x2' 停下来。
所以,我可以看到正在调用 moc.exe 来生成 debug/testqstring.moc,但从未生成过该文件。
感谢您提供的所有指导。
【问题讨论】:
-
能否包含运行第一个命令时生成的.pro文件?
-
我遇到了同样的问题。但我通过从
/bin 目录中删除文件 qt.conf 解决了这个问题。