I'm trying to build the qtestlib/tutorial1 example, but the testqstring.moc file isn't being generated when I run nmake
(I'm running Qt 4.5.2 on Windows XP SP3).
I copied testqstring.cpp from the tutorial directory to my build directory (C:\sandboxes\testqstring) and from the Qt command prompt ran vsvars32.bat file from my MS Visual Studio 8 installation to add the VS environment variables.
我正在尝试构建qtestlib/tutorial1示例,但是testqstring。当我运行nmake时,moc文件不会生成(我在Windows XP SP3上运行Qt 4.5.2)。我复制testqstring。cpp从教程目录到我的构建目录(C:\sandbox \testqstring)和Qt命令提示符运行vsvars32。bat文件来自我的Visual Studio 8安装,以添加VS环境变量。
According to the tutorial, I should run:
根据教程,我应该运行:
> qmake -project "CONFIG += qtestlib"
> qmake
> nmake
When I do, the output from nmake
is:
当我这样做时,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
C:/应用程序/ Qt / 2009.03 / Qt / bin \商务部。exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_TESTLIB_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT我“.... \程序\ Qt \ 2009.03 \ Qt \ \ QtCore包括“我”.... \程序\ Qt \ 2009.03 \ Qt \ \ QtGui包括“我”.... \程序\ Qt \ 2009.03 \ Qt \ \ Qt包括“我”.... \程序\ Qt \ 2009.03 \ Qt \包括“我”。“我“.... \程序\ Qt \ 2009.03 \ Qt \ \ ActiveQt包括“我“调试”——“.... \程序\ Qt \ 2009.03 \ Qt \ mkspecs \ win32-g + +”-D__GNUC__ -DWIN32 testqstring。cpp - o调试\ 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
- - -DQT_DLL - - -DQT_DLL -DQT_DLL -DQT_DLL -DQT_DLL -DQT_DLL - dqt_- dqt_- dqt_core_lib -DQT_CORE_LIB -DQT_THREAD_SUPPORT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -“- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -我“.... \程序\ Qt \ 2009.03 \ Qt \ \ ActiveQt包括“我“调试”——“.... \程序\ Qt \ 2009.03 \ Qt \ mkspecs \ win32-g + +“- o调试\ testqstring。o testqstring.cpp
testqstring.cpp:63:27: testqstring.moc: No such file or directory
NMAKE : fatal error U1077: 'C:\Apps\Qt\2009.03\mingw\bin\g++.EXE' : return code '0x1' Stop.
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC\BIN\nmake.exe' : return code '0x2' Stop.testqstring。cpp:63:27:testqstring。moc:没有这样的文件或目录NMAKE:致命错误U1077: 'C:\应用\Qt\2009.03\mingw\bin\g++。EXE:返回代码'0x1' Stop。NMAKE:致命错误U1077:“C:\进”~1\MICROS~3\VC\BIN\ NMAKE。exe:返回代码'0x2'停止。
So, I can see that moc.exe is being called to generate debug/testqstring.moc, but that file is never generated.
我可以看到moc。正在调用exe生成调试/testqstring。moc,但是这个文件从来没有生成过。
Thank you for any and all guidance you can provide.
感谢您所提供的一切指导。
5 个解决方案
#1
4
It looks like you're trying to use nmake
to do a build with MinGW. nmake
is an MSVC tool.
看起来你想用nmake和MinGW做一个构建。nmake是一个MSVC工具。
If you want to do a build with MinGW you must use mingw32-make
. If you want to do a build with MSVC you must use a Qt built with MSVC (which means you have to build it yourself or have a commercial license).
如果您想要使用MinGW进行构建,您必须使用mingw32-make。如果您想要使用MSVC构建一个构建,您必须使用MSVC构建的Qt(这意味着您必须自己构建或拥有一个商业许可证)。
#2
2
I had the problem that the moc.exe didn't generate any moc-files with nmake. The reason was a wrong moc.exe path inside the Makefile.Debug.
我遇到了moc的问题。exe没有使用nmake生成任何moc文件。原因是错误的。在Makefile.Debug内的exe路径。
Something like:
喜欢的东西:
C:/Qt/2009.03/qt/bin\moc.exe
C:/ Qt / 2009.03 / Qt / bin \ moc.exe
I change it to:
我将其更改为:
C:\Qt\2009.03\qt\bin\moc.exe
C:\ Qt \ 2009.03 \ Qt \ bin \ moc.exe
and now it works. ;)
现在它的工作原理。,)
Unfortunally qmake will generate the makefiles everytime you run it from the menu or rebuild/clean the solution/project. I think it's a bug of the qmake configuration.
不幸的是,每当你从菜单中运行它,或者重新构建/清理解决方案/项目时,它就会生成makefile。我认为这是qmake配置的错误。
To fix it permanently you have to find the file C:\MyQtDir\mkspecs\win32-msvc2008\qmake.conf. For other configs you have to change win32-msvc2008.
要永久修复它,您必须找到文件C:\MyQtDir\mkspecs\win32-msvc2008\qmake.conf。对于其他配置,您必须更改win32-msvc2008。
For me it was at C:\Qt\2009.03\qt\mkspecs\win32-msvc2008\qmake.conf
对我来说,它是在C:\Qt\2009.03\ Qt\ mkspecs\win32-msvc2008\qmake.conf。
Search for the phrase "QMAKE_MOC". You will find some lines like this:
搜索短语“QMAKE_MOC”。你会发现一些这样的句子:
QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe
QT_INSTALL_BINS is a path that seems to be wrong. The directory separators are still '/' but should be '\'. At the moment I don't know exactly where I have to change QT_INSTALL_BINS. But the qt path won't change for me so I replaced the macro by hard-defined pathnames:
qt_install_bin是一条似乎是错误的路径。目录分隔符仍然是'/'但应该是'\'。目前我还不知道要在哪里更改qt_install_bin。但是qt路径不会改变,所以我用硬定义的路径替换了宏:
QMAKE_MOC = C:\Qt\2009.03\qt\bin\moc.exe
QMAKE_UIC = C:\Qt\2009.03\qt\bin\uic.exe
QMAKE_IDC = C:\Qt\2009.03\qt\bin\idc.exe
Now there are no problems with the moc anymore. Rebuilds will work fine too.
现在moc已经没有问题了。重建也会很好。
Hope this helps ;)
希望这有助于;)
#3
1
Have you tried using the compiler/tools included with Qt in /mingw/bin? (On my system, Qt is installed in C:\Qt\2009.03.) Last time I checked, the non-commercial distribution of Qt will not work with Visual Studio. I just tried this from the Qt command prompt and it worked.
你试过使用包含Qt /mingw/bin的编译器/工具吗?(在我的系统中,Qt安装在C:\Qt\2009.03。)上次我检查的时候,Qt的非商业性分布不会和Visual Studio一起工作。我刚从Qt命令提示中尝试过,它成功了。
qmake -project "CONFIG += qtestlib"
qmake
mingw32-make
Hope this helps.
希望这个有帮助。
#4
0
Ar you sure the moc isn't generated? It lives in the Debug directory, so you will either need to #include "Debug/teststring.moc" or #include with an additional -IDebug compiler option.
你确定moc没有生成吗?它位于调试目录中,因此您将需要包括“Debug/teststring”。moc“或#include有一个附加的-IDebug编译器选项。
#5
0
In case of yet compiling with VC nmake there is a workaround for this bug here: http://bugreports.qt-project.org/browse/QTBUG-6470
在使用VC nmake进行编译时,这里有一个解决这个bug的方法:http://bugreports.qt-project.org/browse/QTBUG-6470。
#1
4
It looks like you're trying to use nmake
to do a build with MinGW. nmake
is an MSVC tool.
看起来你想用nmake和MinGW做一个构建。nmake是一个MSVC工具。
If you want to do a build with MinGW you must use mingw32-make
. If you want to do a build with MSVC you must use a Qt built with MSVC (which means you have to build it yourself or have a commercial license).
如果您想要使用MinGW进行构建,您必须使用mingw32-make。如果您想要使用MSVC构建一个构建,您必须使用MSVC构建的Qt(这意味着您必须自己构建或拥有一个商业许可证)。
#2
2
I had the problem that the moc.exe didn't generate any moc-files with nmake. The reason was a wrong moc.exe path inside the Makefile.Debug.
我遇到了moc的问题。exe没有使用nmake生成任何moc文件。原因是错误的。在Makefile.Debug内的exe路径。
Something like:
喜欢的东西:
C:/Qt/2009.03/qt/bin\moc.exe
C:/ Qt / 2009.03 / Qt / bin \ moc.exe
I change it to:
我将其更改为:
C:\Qt\2009.03\qt\bin\moc.exe
C:\ Qt \ 2009.03 \ Qt \ bin \ moc.exe
and now it works. ;)
现在它的工作原理。,)
Unfortunally qmake will generate the makefiles everytime you run it from the menu or rebuild/clean the solution/project. I think it's a bug of the qmake configuration.
不幸的是,每当你从菜单中运行它,或者重新构建/清理解决方案/项目时,它就会生成makefile。我认为这是qmake配置的错误。
To fix it permanently you have to find the file C:\MyQtDir\mkspecs\win32-msvc2008\qmake.conf. For other configs you have to change win32-msvc2008.
要永久修复它,您必须找到文件C:\MyQtDir\mkspecs\win32-msvc2008\qmake.conf。对于其他配置,您必须更改win32-msvc2008。
For me it was at C:\Qt\2009.03\qt\mkspecs\win32-msvc2008\qmake.conf
对我来说,它是在C:\Qt\2009.03\ Qt\ mkspecs\win32-msvc2008\qmake.conf。
Search for the phrase "QMAKE_MOC". You will find some lines like this:
搜索短语“QMAKE_MOC”。你会发现一些这样的句子:
QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe
QT_INSTALL_BINS is a path that seems to be wrong. The directory separators are still '/' but should be '\'. At the moment I don't know exactly where I have to change QT_INSTALL_BINS. But the qt path won't change for me so I replaced the macro by hard-defined pathnames:
qt_install_bin是一条似乎是错误的路径。目录分隔符仍然是'/'但应该是'\'。目前我还不知道要在哪里更改qt_install_bin。但是qt路径不会改变,所以我用硬定义的路径替换了宏:
QMAKE_MOC = C:\Qt\2009.03\qt\bin\moc.exe
QMAKE_UIC = C:\Qt\2009.03\qt\bin\uic.exe
QMAKE_IDC = C:\Qt\2009.03\qt\bin\idc.exe
Now there are no problems with the moc anymore. Rebuilds will work fine too.
现在moc已经没有问题了。重建也会很好。
Hope this helps ;)
希望这有助于;)
#3
1
Have you tried using the compiler/tools included with Qt in /mingw/bin? (On my system, Qt is installed in C:\Qt\2009.03.) Last time I checked, the non-commercial distribution of Qt will not work with Visual Studio. I just tried this from the Qt command prompt and it worked.
你试过使用包含Qt /mingw/bin的编译器/工具吗?(在我的系统中,Qt安装在C:\Qt\2009.03。)上次我检查的时候,Qt的非商业性分布不会和Visual Studio一起工作。我刚从Qt命令提示中尝试过,它成功了。
qmake -project "CONFIG += qtestlib"
qmake
mingw32-make
Hope this helps.
希望这个有帮助。
#4
0
Ar you sure the moc isn't generated? It lives in the Debug directory, so you will either need to #include "Debug/teststring.moc" or #include with an additional -IDebug compiler option.
你确定moc没有生成吗?它位于调试目录中,因此您将需要包括“Debug/teststring”。moc“或#include有一个附加的-IDebug编译器选项。
#5
0
In case of yet compiling with VC nmake there is a workaround for this bug here: http://bugreports.qt-project.org/browse/QTBUG-6470
在使用VC nmake进行编译时,这里有一个解决这个bug的方法:http://bugreports.qt-project.org/browse/QTBUG-6470。