Qt moc.exe does not create * .moc file

I am trying to create the qtestlib / tutorial1 example, but the testqstring.moc file is not created at startup nmake(I am running Qt 4.5.2 on Windows XP Service Pack 3).
I copied testqstring.cpp from the tutorial directory to my build directory (C: \ sandboxes \ testqstring) and from the Qt command line I launched the vsvars32.bat file from my MS Visual Studio 8 installation to add VS environment variables.

According to the tutorial, I have to run:

> qmake -project "CONFIG += qtestlib"
> qmake
> nmake

When I do this, the output from 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_SUPPt QtIt QtIt QtIt QtIt QtIt QtIt QtIt QtIt QtItore QtItore qtptort qtitt qti qti qti qti -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, .

, .

+5
5

, nmake MinGW. nmake - MSVC.

MinGW, mingw32-make. MSVC, Qt, MSVC ( , ).

+4

, moc.exe moc nmake. moc.exe Makefile.Debug.

- :

C:/Qt/2009.03/qt/bin\moc.exe

:

C:\Qt\2009.03\Qt\Bin\moc.exe

.;)

, qmake make , / /. , qmake.

, C:\MyQtDir\mkspecs\win32-msvc2008\qmake.conf. win32-msvc2008.

C:\Qt\2009.03\qt\mkspecs\win32-msvc2008\qmake.conf

"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 - , . - "/", "\". , QT_INSTALL_BINS. 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

moc. .

, ;)

+2

/, Qt in/mingw/bin? ( Qt C:\Qt\2009.03.) , , Qt Visual Studio. Qt, .

qmake -project "CONFIG += qtestlib"

qmake

mingw32-make

, .

+1
source

Are you sure moc is not generated? It lives in the Debug directory, so you need to either enable # debug / teststring.moc or #include with the -IDebug option of the compiler.

0
source

When compiling with VC nmake, there is a workaround for this error: http://bugreports.qt-project.org/browse/QTBUG-6470

0
source

All Articles