在Windows上构建Qt 5.9项目时OpenGL链接错误

时间:2017-06-13 13:12:00

标签: c++ windows qt opengl qt5

我试图在Windows上使用MSVC2017 64位构建Qt 5.9项目并使用预构建的Qt二进制文件。 该项目依赖于QNanoPainter来创建自定义项目,这些项目使用NanoVG作为渲染后端进行原始OpenGL调用。

当尝试构建时,它看起来像链接到系统版本OpenGL,在Windows上是1.0,并返回许多未解析的外部符号,如果我没有弄错,那么OpenGL 1.0上都没有这些功能。您可以在下面看到未解决的符号列表。

我已经尝试了各种解决方案,例如将LIBS += opengl32.lib添加到我的.pro文件中,但它会保持链接到系统版本。 GPU驱动程序已更新至最新版本。这不是未重新生成的Makefile的问题,因为每次修改qmake时我都会运行.pro

如何链接正确的OpenGL版本以便编译成功返回?

qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glBindTexture referenced in function "void __cdecl glnvg__bindTexture(struct GLNVGcontext *,unsigned int,unsigned int)" (?glnvg__bindTexture@@YAXPEAUGLNVGcontext@@II@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glBlendFunc referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glColorMask referenced in function "void __cdecl glnvg__fill(struct GLNVGcontext *,struct GLNVGcall *)" (?glnvg__fill@@YAXPEAUGLNVGcontext@@PEAUGLNVGcall@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glCullFace referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glDeleteTextures referenced in function "int __cdecl glnvg__deleteTexture(struct GLNVGcontext *,int)" (?glnvg__deleteTexture@@YAHPEAUGLNVGcontext@@H@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glDisable referenced in function "void __cdecl glnvg__fill(struct GLNVGcontext *,struct GLNVGcall *)" (?glnvg__fill@@YAXPEAUGLNVGcontext@@PEAUGLNVGcall@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glDrawArrays referenced in function "void __cdecl glnvg__fill(struct GLNVGcontext *,struct GLNVGcall *)" (?glnvg__fill@@YAXPEAUGLNVGcontext@@PEAUGLNVGcall@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glEnable referenced in function "void __cdecl glnvg__fill(struct GLNVGcontext *,struct GLNVGcall *)" (?glnvg__fill@@YAXPEAUGLNVGcontext@@PEAUGLNVGcall@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glFinish referenced in function "int __cdecl glnvg__renderCreate(void *)" (?glnvg__renderCreate@@YAHPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glFrontFace referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glGenTextures referenced in function "int __cdecl glnvg__renderCreateTexture(void *,int,int,int,int,unsigned char const *)" (?glnvg__renderCreateTexture@@YAHPEAXHHHHPEBE@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glGetError referenced in function "void __cdecl glnvg__checkError(struct GLNVGcontext *,char const *,int)" (?glnvg__checkError@@YAXPEAUGLNVGcontext@@PEBDH@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glPixelStorei referenced in function "int __cdecl glnvg__renderCreateTexture(void *,int,int,int,int,unsigned char const *)" (?glnvg__renderCreateTexture@@YAHPEAXHHHHPEBE@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glStencilFunc referenced in function "void __cdecl glnvg__stencilFunc(struct GLNVGcontext *,unsigned int,int,unsigned int)" (?glnvg__stencilFunc@@YAXPEAUGLNVGcontext@@IHI@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glStencilMask referenced in function "void __cdecl glnvg__stencilMask(struct GLNVGcontext *,unsigned int)" (?glnvg__stencilMask@@YAXPEAUGLNVGcontext@@I@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glStencilOp referenced in function "void __cdecl glnvg__fill(struct GLNVGcontext *,struct GLNVGcall *)" (?glnvg__fill@@YAXPEAUGLNVGcontext@@PEAUGLNVGcall@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glTexImage2D referenced in function "int __cdecl glnvg__renderCreateTexture(void *,int,int,int,int,unsigned char const *)" (?glnvg__renderCreateTexture@@YAHPEAXHHHHPEBE@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glTexParameteri referenced in function "int __cdecl glnvg__renderCreateTexture(void *,int,int,int,int,unsigned char const *)" (?glnvg__renderCreateTexture@@YAHPEAXHHHHPEBE@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol __imp_glTexSubImage2D referenced in function "int __cdecl glnvg__renderUpdateTexture(void *,int,int,int,int,int,unsigned char const *)" (?glnvg__renderUpdateTexture@@YAHPEAXHHHHHPEBE@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glActiveTexture referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glBindBuffer referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glDeleteBuffers referenced in function "void __cdecl glnvg__renderDelete(void *)" (?glnvg__renderDelete@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glGenBuffers referenced in function "int __cdecl glnvg__renderCreate(void *)" (?glnvg__renderCreate@@YAHPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glBufferData referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glStencilOpSeparate referenced in function "void __cdecl glnvg__fill(struct GLNVGcontext *,struct GLNVGcall *)" (?glnvg__fill@@YAXPEAUGLNVGcontext@@PEAUGLNVGcall@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glAttachShader referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glBindAttribLocation referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glCompileShader referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glCreateProgram referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glCreateShader referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glDeleteProgram referenced in function "void __cdecl glnvg__deleteShader(struct GLNVGshader *)" (?glnvg__deleteShader@@YAXPEAUGLNVGshader@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glDeleteShader referenced in function "void __cdecl glnvg__deleteShader(struct GLNVGshader *)" (?glnvg__deleteShader@@YAXPEAUGLNVGshader@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glDisableVertexAttribArray referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glEnableVertexAttribArray referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glGetProgramiv referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glGetProgramInfoLog referenced in function "void __cdecl glnvg__dumpProgramError(unsigned int,char const *)" (?glnvg__dumpProgramError@@YAXIPEBD@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glGetShaderiv referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glGetShaderInfoLog referenced in function "void __cdecl glnvg__dumpShaderError(unsigned int,char const *,char const *)" (?glnvg__dumpShaderError@@YAXIPEBD0@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glGetUniformLocation referenced in function "void __cdecl glnvg__getUniforms(struct GLNVGshader *)" (?glnvg__getUniforms@@YAXPEAUGLNVGshader@@@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glLinkProgram referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glShaderSource referenced in function "int __cdecl glnvg__createShader(struct GLNVGshader *,char const *,char const *,char const *,char const *,char const *)" (?glnvg__createShader@@YAHPEAUGLNVGshader@@PEBD1111@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glUseProgram referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glUniform1i referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glUniform3fv referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glUniform4fv referenced in function "void __cdecl glnvg__setUniforms(struct GLNVGcontext *,int,int)" (?glnvg__setUniforms@@YAXPEAUGLNVGcontext@@HH@Z)
qnanopainter.obj : error LNK2019: unresolved external symbol glVertexAttribPointer referenced in function "void __cdecl glnvg__renderFlush(void *)" (?glnvg__renderFlush@@YAXPEAX@Z)

它不是Unresolved external symbols - Qt creator的副本,我在每次编辑qmake文件后运行.pro,如上所述。

0 个答案:

没有答案