使用Desktop OpenGL构建Qt时出错

Error when building Qt with Desktop OpenGL

本文关键字:出错 Qt 构建 Desktop OpenGL 使用      更新时间:2023-10-16

我使用默认配置成功构建了Qt5.5.1:

configure -debug-and-release -opensource -platform win32-msvc2015

然后

nmake

由于此版本默认支持QtANGLE,因此我使用以下配置将Qt 5.5.1重建为目标Desktop OpenGL:

configure -debug-and-release -opensource -opengl desktop -platform win32-msvc2015

然后

nmake

但我有很多错误,这是输出:

Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation.  All rights reserved.
        cl -c -FIqt_gui_pch.h -Yuqt_gui_pch.h -Fp.pchdebugQt5Guid_pch.pch -nol
ogo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -MDd -D_HAS_EXCEPTIONS
=0 -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 /Fd....lib
Qt5Guid.pdb -DUNICODE -DWIN32 -DWIN64 -DQT_NO_USING_NAMESPACE -DQT_BUILD_GUI_LIB
 -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_
ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPR
ECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_USE_BUNDLED_LIBPNG
-DPNG_ARM_NEON_OPT=0 -DQT_ENABLE_HARFBUZZ_NG -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_A
NGLE -DQT_NO_EXCEPTIONS -DQT_CORE_LIB -I. -I....include -I....includeQtGui
-I....includeQtANGLE -I....includeQtGui5.5.1 -I....includeQtGui5.5.1
QtGui -Itmp -I..3rdpartylibpng -I..3rdpartyzlib -I..3rdpartyharfbuzz-ngin
clude -I..3rdpartyzlib -I....includeQtCore5.5.1 -I....includeQtCore5.5
.1QtCore -I....includeQtCore -I.mocdebug -I....mkspecswin32-msvc2015 -Fo
.objdebug @C:UsersUserAppDataLocalTempnm8A5A.tmp
qopenglcontext.cpp
kernelqopenglcontext.cpp(364): error C2065: 'GL_PROXY_TEXTURE_2D': undeclared i
dentifier
kernelqopenglcontext.cpp(370): error C2065: 'QOpenGLFunctions_1_0': undeclared
identifier
kernelqopenglcontext.cpp(370): error C2065: 'gl1funcs': undeclared identifier
kernelqopenglcontext.cpp(371): error C2065: 'QOpenGLFunctions_3_2_Core': undecl
ared identifier
kernelqopenglcontext.cpp(371): error C2065: 'gl3funcs': undeclared identifier
kernelqopenglcontext.cpp(374): error C2065: 'gl3funcs': undeclared identifier
kernelqopenglcontext.cpp(374): error C2065: 'QOpenGLFunctions_3_2_Core': undecl
ared identifier
kernelqopenglcontext.cpp(374): error C2672: 'QOpenGLContext::versionFunctions':
 no matching overloaded function found
kernelqopenglcontext.cpp(374): error C2974: 'QOpenGLContext::versionFunctions':
 invalid template argument for 'TYPE', type expected
e:blind_sys_v02libsqt5.5.1qt-everywhere-opensource-src-5.5.1qtbaseinclude
qtgui../../src/gui/kernel/qopenglcontext.h(181): note: see declaration of 'QOp
enGLContext::versionFunctions'
kernelqopenglcontext.cpp(376): error C2065: 'gl1funcs': undeclared identifier
kernelqopenglcontext.cpp(376): error C2065: 'QOpenGLFunctions_1_0': undeclared
identifier
kernelqopenglcontext.cpp(376): error C2672: 'QOpenGLContext::versionFunctions':
 no matching overloaded function found
kernelqopenglcontext.cpp(376): error C2974: 'QOpenGLContext::versionFunctions':
 invalid template argument for 'TYPE', type expected
e:blind_sys_v02libsqt5.5.1qt-everywhere-opensource-src-5.5.1qtbaseinclude
qtgui../../src/gui/kernel/qopenglcontext.h(181): note: see declaration of 'QOp
enGLContext::versionFunctions'
kernelqopenglcontext.cpp(378): error C2065: 'gl1funcs': undeclared identifier
kernelqopenglcontext.cpp(378): error C2065: 'gl3funcs': undeclared identifier
kernelqopenglcontext.cpp(380): error C2065: 'gl1funcs': undeclared identifier
kernelqopenglcontext.cpp(381): error C2065: 'gl1funcs': undeclared identifier
kernelqopenglcontext.cpp(381): error C2227: left of '->glGetTexLevelParameteriv
' must point to class/struct/union/generic type
kernelqopenglcontext.cpp(381): note: type is 'unknown-type'
kernelqopenglcontext.cpp(381): error C2065: 'GL_TEXTURE_WIDTH': undeclared iden
tifier
kernelqopenglcontext.cpp(383): error C2065: 'gl3funcs': undeclared identifier
kernelqopenglcontext.cpp(383): error C2227: left of '->glGetTexLevelParameteriv
' must point to class/struct/union/generic type
kernelqopenglcontext.cpp(383): note: type is 'unknown-type'
kernelqopenglcontext.cpp(383): error C2065: 'GL_TEXTURE_WIDTH': undeclared iden
tifier
kernelqopenglcontext.cpp(395): error C2065: 'gl1funcs': undeclared identifier
kernelqopenglcontext.cpp(396): error C2065: 'gl1funcs': undeclared identifier
kernelqopenglcontext.cpp(396): error C2227: left of '->glGetTexLevelParameteriv
' must point to class/struct/union/generic type
kernelqopenglcontext.cpp(396): note: type is 'unknown-type'
kernelqopenglcontext.cpp(396): error C2065: 'GL_TEXTURE_WIDTH': undeclared iden
tifier
kernelqopenglcontext.cpp(398): error C2065: 'gl3funcs': undeclared identifier
kernelqopenglcontext.cpp(398): error C2227: left of '->glGetTexLevelParameteriv
' must point to class/struct/union/generic type
kernelqopenglcontext.cpp(398): note: type is 'unknown-type'
kernelqopenglcontext.cpp(398): error C2065: 'GL_TEXTURE_WIDTH': undeclared iden
tifier
NMAKE : fatal error U1077: '"C:Program Files (x86)Microsoft Visual Studio 14.0
VCBINamd64cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:Program Files (x86)Microsoft Visual Studio 14.0
VCBINamd64nmake.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.

你对可能的解决方案有想法吗?

请删除整个Qt文件夹。再次从Qt档案中提取(到一个全新的文件夹中),使用您的新选项进行配置并构建。它应该起作用。

更改配置选项时的增量构建是有风险的,并且根本不能保证工作。