小编Dou*_*son的帖子

Qt moc.exe没有生成*.moc文件

我正在尝试构建qtestlib/tutorial1示例,但是当我运行时没有生成testqstring.moc文件nmake(我在Windows XP SP3上运行Qt 4.5.2).
我将testqstring.cpp从tutorial目录复制到我的构建目录(C:\ sandboxes\testqstring),并从Qt命令提示符运行我的MS Visual Studio 8安装中的vsvars32.bat文件来添加VS环境变量.

根据教程,我应该运行:

> qmake -project "CONFIG += qtestlib"
> qmake
> nmake
Run Code Online (Sandbox Code Playgroud)

当我这样做时,输出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"debug"-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"debug"-I"....\Apps\Qt\2009.03\qt\mkspecs\win32-g ++"-o debug\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,但是从不生成该文件.

感谢您提供的任何和所有指导.

qt qmake nmake

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

nmake ×1

qmake ×1

qt ×1