使用MSVC ++ 2017 x64编译器在调试模式下编译Qt 5.10失败。在发布模式下,不会出现错误。
错误本身是:
```
C:\Qt\5.10\build\qtbase\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -D_WINDLL --compiler-flavor=msvc --include .moc/debug/moc_predefs.h -IC:/Qt/5.10/qtbase/mkspecs/win32-msvc -IC:/Qt/5.10/qtbase/src/corelib -IC:/Qt/5.10/qtbase/src/3rdparty/zlib/src -IC:/Qt/5.10/build/qtbase/src/corelib/global -IC:/Qt/5.10/qtbase/src/3rdparty/harfbuzz/src -IC:/Qt/5.10/qtbase/src/3rdparty/md5 -IC:/Qt/5.10/qtbase/src/3rdparty/md4 -IC:/Qt/5.10/qtbase/src/3rdparty/sha3 -IC:/Qt/5.10/qtbase/src/3rdparty/double-conversion/include -IC:/Qt/5.10/qtbase/src/3rdparty/double-conversion/include/double-conversion -IC:/Qt/5.10/qtbase/include -IC:/Qt/5.10/qtbase/include/QtCore -IC:/Qt/5.10/build/qtbase/include -IC:/Qt/5.10/build/qtbase/include/QtCore -IC:/Qt/5.10/qtbase/include/QtCore/5.10.0 -IC:/Qt/5.10/qtbase/include/QtCore/5.10.0/QtCore -IC:/Qt/5.10/build/qtbase/include/QtCore/5.10.0 -IC:/Qt/5.10/build/qtbase/include/QtCore/5.10.0/QtCore -IC:/Qt/5.10/qtbase/src/corelib/tmp -I. -I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" C:\Qt\5.10\qtbase\src\corelib\mimetypes\qmimetype.h -o .moc\debug\moc_qmimetype.cpp
rc /NOLOGO -D_DEBUG -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -D_WINDLL -fo .obj\debug\Qt5Cored_resource.res Qt5Cored_resource.rc
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -utf-8 -EHsc -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 /Fd.obj\debug\Qt5Cored.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -D_WINDLL -IC:\Qt\5.10\qtbase\src\corelib -I. -IC:\Qt\5.10\qtbase\src\3rdparty\zlib\src -Iglobal -IC:\Qt\5.10\qtbase\src\3rdparty\harfbuzz\src -IC:\Qt\5.10\qtbase\src\3rdparty\md5 -IC:\Qt\5.10\qtbase\src\3rdparty\md4 -IC:\Qt\5.10\qtbase\src\3rdparty\sha3 -IC:\Qt\5.10\qtbase\src\3rdparty\double-conversion\include -IC:\Qt\5.10\qtbase\src\3rdparty\double-conversion\include\double-conversion -IC:\Qt\5.10\qtbase\include -IC:\Qt\5.10\qtbase\include\QtCore -I..\..\include -I..\..\include\QtCore -IC:\Qt\5.10\qtbase\include\QtCore\5.10.0 -IC:\Qt\5.10\qtbase\include\QtCore\5.10.0\QtCore -I..\..\include\QtCore\5.10.0 -I..\..\include\QtCore\5.10.0\QtCore -Itmp -I.moc\debug -IC:\Qt\5.10\qtbase\src\3rdparty\pcre2\src -IC:\OpenSSL-Win64\include -IC:\Qt\5.10\qtbase\mkspecs\win32-msvc -Fo.obj\debug\ @C:\Users\ROTTER~2.PRA\AppData\Local\Temp\nmAD99.tmp
qabstractanimation.cpp
qvariantanimation.cpp
qpropertyanimation.cpp
qanimationgroup.cpp
qsequentialanimationgroup.cpp
qparallelanimationgroup.cpp
qpauseanimation.cpp
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\cl.EXE"' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
```
我正在使用" nmake.exe"。使用的配置步骤是:
```
C:\Qt\5.10\configure.bat -opensource -skip qtgamepad -skip qtcharts -skip qtandroidextras -skip qtmacextras -skip qtwebengine -skip qtnetworkauth -skip qtdatavis3d -skip qtcanvas3d -skip qt3d -skip qtactiveqt -skip qtdoc -skip qtlocation -skip qtcharts -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtsensors -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -skip qtconnectivity -skip qtdeclarative -skip qtscxml -skip qtmultimedia -nomake examples -platform win32-msvc2017 -qt-zlib -qt-libjpeg -qt-libpng -qt-xcb -qt-xkbcommon -qt-freetype -qt-pcre -qt-harfbuzz -prefix "C:\Qt\5.10\Qt" -openssl -I "C:\OpenSSL-Win64\include" -L "C:\OpenSSL-Win64\lib\VC" -nomake tests -nomake tools -dbus no -skip qttools -debug -confirm-license -no-qml-debug -shared -no-pch
```
由于错误输出并未真正显示任何特定的错误消息,所以我完全不知道会出现什么问题。有什么想法吗?
答案 0 :(得分:0)
QRandomGenerator定义与MSVC定义的min macro冲突。请参阅related bug in Qt。它已经修复,可以在Qt 5.10.1中找到。
作为解决方法,您可以添加
#undef min
包括Qt标题之前。