简体   繁体   中英

Static Qt program build in VS2013 - a lot of unresolved externals

After nights trying to build Qt properly at last I made it with:

configure -static -debug-and-release -developer-build -mp -opengl desktop -platform win32-msvc2013 -no-webkit -qt-zlib

and

/MT, MTd flags in mkspecs\\win32-msvc2013\\qmake.conf
but it did not help me much.

I am using VS2013 Pro, with QT Add-in 1.2.3, and when I tried to compile add-in template I received 55 unresolved external errors, most of them was from OpenGL, so I added opengl32.lib to linker, and error number reduced to 42, but still most of them are from OpenGL. Libs like GLU32 or Qt5OpenGL did not helped me at all.

Here are few unresolved external symbols errors from linker:

_WSAAsyncSelect@16 referenced in function "private: void __thiscall QEventDispatcherWin32::createInternalHwnd(void)" (?createInternalHwnd@QEventDispatcherWin32@@AAEXXZ)
_glBindBuffer@8 referenced in function "public: bool __thiscall QOpenGLBuffer::bind(void)" (?bind@QOpenGLBuffer@@QAE_NXZ)
_glCompileShader@4 referenced in function "public: bool __thiscall QOpenGLShaderPrivate::compile(class QOpenGLShader *)" (?compile@QOpenGLShaderPrivate@@QAE_NPAVQOpenGLShader@@@Z)
_glUniform4fv@12 referenced in function "public: void __thiscall QOpenGLFunctions::glUniform4fv(int,int,float const *)" (?glUniform4fv@QOpenGLFunctions@@QAEXHHPBM@Z)

And for me its quite strange, cos those errors are from core gl lib, which is linked :

qtmain.lib
Qt5Core.lib
Qt5Gui.lib
Qt5Widgets.lib
opengl32.lib

Does anyone know how to fix it?

Can you please tell us which Qt version have you downloaded from the Qt website ?

Also, you have to be careful because Qt is not bundle with openGL by default, you have to download the proper version (the one with openGL in the name obviously)

Hope it helps!

You could try out the following libraries:

imm32.lib winmm.lib Ws2_32.lib qtharfbuzzng.lib

This worked for me: https://stackoverflow.com/a/27807379/4415923

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM