尝试在QT中编译项目时出现Jom错误

时间:2016-06-01 12:52:03

标签: c++ qt makefile

我正在尝试运行我的项目,它设法构建但由于此编译错误而快速终止。我在Windows套件10,visual studio 14和directx中使用64位库。

    13:29:13: Running steps for project Phase64...
13:29:13: Configuration unchanged, skipping qmake step.
13:29:13: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe" 
    C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
    C:\Qt\5.6\msvc2015_64\bin\moc.exe -DUNICODE -DWIN32 -DWIN64 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -D_WIN32 -D_WIN64 -IC:/Qt/5.6/msvc2015_64/mkspecs/win32-msvc2015 -IC:/Users/Phenom/Documents/QT/Phase64 -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.10150.0/ucrt" -I"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include" -I"C:/Program Files (x86)/Microsoft DirectX SDK (February 2010)/Include" -I"C:/Program Files (x86)/Microsoft DirectX SDK (February 2010)/Include" -IC:/boost/boost_1_61_0 -I"C:/Program Files (x86)/Microsoft DirectX SDK (February 2010)/Include" -I"C:/Program Files (x86)/Windows Kits/10/Include" -I"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/atlmfc/include" -IC:/Qt/5.6/msvc2015_64/include -IC:/Qt/5.6/msvc2015_64/include/QtWidgets -IC:/Qt/5.6/msvc2015_64/include/QtGui -IC:/Qt/5.6/msvc2015_64/include/QtANGLE -IC:/Qt/5.6/msvc2015_64/include/QtCore -I. ..\Phase64\mainwindow.h -o debug\moc_mainwindow.cpp
:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/atlmfc/include/atlbase.(3210): Parse error at "__identifier"
jom: C:\Users\me\Documents\QT\build-Phase64-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\Makefile.Debug [debug\moc_mainwindow.cpp] Error 1
    cl -c -FIstdafx.h -Yustdafx.h -Fpdebug\Phase64_pch.pch -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -MDd -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -EHsc /Fddebug\Phase64.pdb -DUNICODE -DWIN32 -DWIN64 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\Phase64 -I. -I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" -I"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include" -I"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include" -IC:\boost\boost_1_61_0 -I"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include" -I"C:\Program Files (x86)\Windows Kits\10\Include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include" -IC:\Qt\5.6\msvc2015_64\include -IC:\Qt\5.6\msvc2015_64\include\QtWidgets -IC:\Qt\5.6\msvc2015_64\include\QtGui -IC:\Qt\5.6\msvc2015_64\include\QtANGLE -IC:\Qt\5.6\msvc2015_64\include\QtCore -Idebug -I. -IC:\Qt\5.6\msvc2015_64\mkspecs\win32-msvc2015 -Fodebug\ @C:\Users\Phenom\AppData\Local\Temp\main.obj.1416.31.jom
main.cpp
    cl -c -FIstdafx.h -Yustdafx.h -Fpdebug\Phase64_pch.pch -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -MDd -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -EHsc /Fddebug\Phase64.pdb -DUNICODE -DWIN32 -DWIN64 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\Phase64 -I. -I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" -I"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include" -I"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include" -IC:\boost\boost_1_61_0 -I"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include" -I"C:\Program Files (x86)\Windows Kits\10\Include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include" -IC:\Qt\5.6\msvc2015_64\include -IC:\Qt\5.6\msvc2015_64\include\QtWidgets -IC:\Qt\5.6\msvc2015_64\include\QtGui -IC:\Qt\5.6\msvc2015_64\include\QtANGLE -IC:\Qt\5.6\msvc2015_64\include\QtCore -Idebug -I. -IC:\Qt\5.6\msvc2015_64\mkspecs\win32-msvc2015 -Fodebug\ @C:\Users\Phenom\AppData\Local\Temp\mainwindow.obj.1416.47.jom
mainwindow.cpp
jom: C:\me\Phenom\Documents\QT\build-Phase64-Desktop_Qt_5_6_0_MSVC2015_64bit-Debug\Makefile [debug] Error 2
13:29:17: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project Phase64 (kit: Desktop Qt 5.6.0 MSVC2015 64bit)
When executing step "Make"
13:29:17: Elapsed time: 00:04.

之前有没有人遇到过这个问题?

3 个答案:

答案 0 :(得分:1)

你的扩展日志显示Qt的moc在ATL标题上窒息:

C:\Qt\5.6\msvc2015_64\bin\moc.exe -DUNICODE -DWIN32 -DWIN64 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -D_WIN32 -D_WIN64 -IC:/Qt/5.6/msvc2015_64/mkspecs/win32-msvc2015 -IC:/Users/Phenom/Documents/QT/Phase64 -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.10150.0/ucrt" -I"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include" -I"C:/Program Files (x86)/Microsoft DirectX SDK (February 2010)/Include" -I"C:/Program Files (x86)/Microsoft DirectX SDK (February 2010)/Include" -IC:/boost/boost_1_61_0 -I"C:/Program Files (x86)/Microsoft DirectX SDK (February 2010)/Include" -I"C:/Program Files (x86)/Windows Kits/10/Include" -I"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/atlmfc/include" -IC:/Qt/5.6/msvc2015_64/include -IC:/Qt/5.6/msvc2015_64/include/QtWidgets -IC:/Qt/5.6/msvc2015_64/include/QtGui -IC:/Qt/5.6/msvc2015_64/include/QtANGLE -IC:/Qt/5.6/msvc2015_64/include/QtCore -I. ..\Phase64\mainwindow.h -o debug\moc_mainwindow.cpp
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/atlmfc/include/atlbase.(3210): Parse error at "__identifier"

这意味着以下任何一项:

  1. moc无法处理ATL污迹,在这种情况下,您需要向Qt提出解决方案(例如,通过提交带有!minimal!示例代码的错误报告) (例如,一个只包含三个文件的项目:main.cppsome_qobject.h / .cpp,其中最后一个文件是..\Phase64\mainwindow.h / .cpp的完全缩减重现这一点。(报告here

  2. 您正在使用代码中的__identifier等宏/标识符,这些宏/标识符由实现保留。修复你的代码不要这样做。

  3. Qt' moc真的无法处理ATL标头。更改您的代码,以便moc ed文件不包含ATL标头。 moc定义了Q_MOC_RUN宏,因此您可以在#ifndef Q_MOC_RUN ... #endif中包装ATL标题,让moc忽略它们。

答案 1 :(得分:1)

我对intersect也有同样的问题。要修复它至少是临时的,请将这行代码包含在pro文件中并运行clean,qmake并构建项目:

Qt 5.9.2

答案 2 :(得分:0)

在Qt 5.8之后,这似乎是moc中已知的回归:https://bugreports.qt.io/browse/QTBUG-56634

报告声称修复已合并到5.9.2,但我仍然遇到问题。