Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows OpenGL Linking problem? #16

Closed
silvanocerza opened this issue Jun 12, 2017 · 7 comments

Comments

@silvanocerza
Copy link

commented Jun 12, 2017

I'm trying to build the examples on Windows with Qt 5.9 and MSVC 2017.
Problem is that it fails at build time since it can't find lots of external symbols like glBindBuffer, glDeleteBuffers and lots of other OpenGL functions, this makes me think that is not linking to correct version of OpenGL.
I commented out DEFINES += QNANO_QT_GL_INCLUDE in include.pri so that OpenGl headers are included manually, since linker tries to include the system version and that's too old.

These are all the unresolved symbols:

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 *)" (?glnvg__checkError@@YAXPEAUGLNVGcontext@@PEBD@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 glBlendFuncSeparate referenced in function "void __cdecl glnvg__blendFuncSeparate(struct GLNVGcontext *,struct GLNVGblend const *)" (?glnvg__blendFuncSeparate@@YAXPEAUGLNVGcontext@@PEBUGLNVGblend@@@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 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)```

Anyone else had this issue? Did you manage to solve it?
@silvanocerza silvanocerza changed the title Windows OpenGL Linking problem versioWindows OpenGL Linking problem? Jun 12, 2017
@silvanocerza silvanocerza changed the title versioWindows OpenGL Linking problem? Windows OpenGL Linking problem? Jun 12, 2017
@gunrot

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2017

i fixed this by adding
LIBS+= -llibGLESV2

win32 {
QT_CONFIG += opengles2 angle
LIBS+= -llibGLESV2
}

@silvanocerza

This comment has been minimized.

Copy link
Author

commented Jun 29, 2017

That builds but it crashes in QNanoPainter constructor since it can't initialize NanoVG context. Here. Do you have the same issue?

@gunrot

This comment has been minimized.

Copy link
Contributor

commented Jun 29, 2017

I checked the gallery example and it ran without error.

@silvanocerza

This comment has been minimized.

Copy link
Author

commented Jun 29, 2017

All three examples crash for me for the same reason. Gallery not right after being launched since the context is initialized later but the other two crash right away. Have you tried the other two?

@gunrot

This comment has been minimized.

Copy link
Contributor

commented Jun 29, 2017

Maybe you should have mentioned that the debug build crashes. I usually run the release build ,which worked. Fixed debug build in my PR #17 .

CONFIG( debug, debug|release ) {
    # debug
    LIBS+= -llibGLESV2d
} else {
    # release
    LIBS+= -llibGLESV2
}
@silvanocerza

This comment has been minimized.

Copy link
Author

commented Jun 30, 2017

Yes, I forgot. It works now, thank you.

@QUItCoding

This comment has been minimized.

Copy link
Owner

commented Jun 30, 2017

Merged the above patch, thanks a lot Gunrot and Alien1993!

@QUItCoding QUItCoding closed this Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.