Important: Please read the Qt Code of Conduct -

Unresolved external symbols when building empty QT project

  • I have installed Visual Studio 2010, Windows SDK and Qt 5.2.1.
    I created an empty qt widgets application project with Qt Creator but it doesn't build, giving me numerous linking errors:

    @MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp__EncodePointer@4 referenced in function _pre_c_init
    MSVCRTD.lib(atonexit.obj) : error LNK2001: unresolved external symbol __imp__EncodePointer@4@

    and so on.

    I also tried rebuilding some examples - and they gave different error:

    @c:\qt\qt5.2.1\5.2.1\src\qtbase\include\qtcore../../src/corelib/global/qt_windows.h(71) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory@

    I have no clue what to do, I tried adding paths to windows.h in PATH and INCLUDE system variables (with no success).

  • Moderators

    Which Qt package have you installed?

  • Qt 5.2.1 for Windows 32-bit (VS 2010, OpenGL)

  • Moderators

    That looks correct. I see 2 possibilities:

    Kit setup in Qt Creator is wrong: please check this (Qt Creator->Tools->Preferences->Build & Run->Kits)

    Another compiler was installed by Windows SDK and it is not compatible with MSVC 2010. In that case, uninstall Windows SDK (you do not need it anyway...)

    1. In Kit setup i see two kits:
    • auto-detected "Desktop Qt 5.2.1 MSVC2010 32bit OpenGL" - chosen as default
    • manual "Qt 5.2.1 (Src)"

    Build fails with both of them.

    1. I'm afraid I need windows sdk (more precise - directx sdk, which is now part of windows sdk, if I'm correct). What should I do?

  • Moderators

    Please verify that the compiler shipped in your SDK is also MSVC 2010. If it is any other version, you will need Qt for that version, too.

  • Why does compiler in SDK matter at all? In build & run ->compilers I can see only three compilers from MSVC 2010 (x86, amd64 and ia64) from correct paths.
    I am compiling with that compiler.. am I not?

  • Moderators

    Right, ok, you probably are ;)

    I keep talking about the SDK because it seems to be the only thing that can interfere here. I know that MSVC 2010 itself works well and without problems, and is being actively used by many people.

  • Riight.. I uninstalled windows SDK. Example still doesn't build with the same error, but empty project now gives:
    LINK : fatal error LNK1104: cannot open file 'glu32.lib'@

    According to "this thread": windows SDK is neccessary for Qt with opengl :)

  • Moderators

    I would imagine only a good driver is needed (nVidia/ AMD/ Intel). But you may be right. I am not too intimate with development on Windows.

  • Riiight, so.. what should I do?

  • I found a suitable workaround in using MiniGW instead of MCVS.

Log in to reply