Qt5Quickd.lib(Qt5Quickd.dll):致命错误 LNK1112:模块机器类型 'x64' 与目标机器类型 'x86' 冲突

Qt5Quickd.lib(Qt5Quickd.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

我正在尝试使用命令行而非 QtCreator GUI 工具构建 Qt 应用程序。我正在使用 VS 2017 的开发人员命令提示符,方法是 运行 执行以下命令:

"C:\Qt\Qt5.13.0.13.0\msvc2017_64\bin\qmake.exe" ..\qt3dsceneeditor.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
"C:\Qt\Qt5.13.0\Tools\QtCreator\bin\jom.exe" -f ../../build-qt3dsceneeditor-Desktop_Qt_5_13_0_MSVC2017_64bit-Debug/Makefile qmake_all
"C:\Qt\Qt5.13.0\Tools\QtCreator\bin\jom.exe"

构建过程一切正常,直到 link 阶段 运行 出现此错误:

link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /DLL /SUBSYSTEM:WINDOWS /MANIFEST:embed /OUT:debug\editorlib.dll @C:\Users\me\AppData\Local\Temp\editorlib.dll.13948.102703.jom
Qt5Quickd.lib(Qt5Quickd.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
jom: C:\Users\me\repos\qt3d-editor\scripts\editorlib\Makefile.Debug [debug\editorlib.dll] Error 1112
jom: C:\Users\me\repos\qt3d-editor\scripts\editorlib\Makefile [debug] Error 2
jom: C:\Users\me\repos\qt3d-editor\scripts\Makefile [sub-editorlib-make_first-ordered] Error 2

我研究了其他人报告的类似错误,提到我需要更改Visual Studio配置。但就我而言,我没有使用 VS GUI。如何更改 VS 2017 开发人员命令提示符 的配置?

如果有人能介绍一个使用命令行工具而不是 QtCreator GUI 构建 Qt 应用程序的好指南,我也很感激!

正如@code_fodder 所建议的,我正在查看 QtCreator 日志。 QtCreator 执行 compiling/linking 没有任何错误:

命令行错误为:

我也试过使用 nmake 而不是 jom,运行 出现了同样的错误:

echo Setting up environment for Qt usage...
set PATH=C:\Qt\Qt5.13.0.13.0\msvc2017_64\bin;%PATH%
echo --------------------------------------
mkdir C:\Users\me\repos\build
cd C:\Users\me\repos\build\
qmake.exe -makefile C:\Users\me\repos\qt3d-editor\qt3dsceneeditor.pro
nmake /u /f Makefile

更新

在 Linux 上,我没有 运行 陷入这样的错误。在 openSUSE Leap 15.1 上,这个脚本工作正常:

#!/bin/sh 

export PATH=~/Qt5.13.0/5.13.0/gcc_64/bin/:$PATH 
mkdir build 
cd build 
qmake ../qt3dsceneeditor.pro -spec linux-icc-64 CONFIG+=qtquickcompiler 
make -j4

此脚本解决了问题:

set PATH=C:\Qt\Qt5.13.0.13.0\msvc2017_64\bin;%PATH%
set PATH=C:\Qt\Qt5.13.0\Tools\QtCreator\bin;%PATH%
mkdir C:\Users\me\repos\qt3d-editor\scripts\build-deploy\temp
cd C:\Users\me\repos\qt3d-editor\scripts\build-deploy\temp
qmake.exe C:\Users\me\repos\qt3d-editor\qt3dsceneeditor.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
jom.exe qmake_all
jom.exe

我不确定哪个修改解决了问题。


在调试模式下构建也很好:

qmake.exe C:\Users\me\repos\qt3d-editor\qt3dsceneeditor.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"

我 运行 VS 2017 的 x64 本机工具命令提示符上的脚本: