Qt World Summit: Register Today!

Error: LNK1104: cannot open file 'gdi32.lib'

  • Hi, I installed Qt, but while building the project I get an error: LNK1104: cannot open file 'gdi32.lib' ("Your text to link here...":http://www.evernote.com/shard/s104/sh/9b17a5d1-d363-4417-a12f-ccffc75e1216/50e75f1d9e8d78e4b1c2014b42026c8d). How can I fix it? Thanks in advance!

  • gdi32.lib is a standard Windows library (for the "graphics device interface":http://msdn.microsoft.com/en-us/library/windows/desktop/dd145203(v=vs.85).aspx).
    If the linker cannot find it, then maybe you haven't properly set things up. Are you are using Visual Studio?

    EDIT: Oh, i just saw your image. You are using the Qt Creator. In that case, what compiler have you installed?

  • http://postimage.org/image/9rv8qt5sn/
    I tried all of them - no luck

  • I see. I have not used Creator before, so i wasn't sure how it was supposed to be setup. But i can see from your image that it has detected both the Microsoft compiler and the SDK, so i'm not sure why it can't find gdi32.lib.

    Perhaps you could search your computer for that file and see if it actually exists anywhere. Then check if that directory is in Creator's list of lib directories. I assume there is some option in Creator to add additional lib directory paths.

  • Yes, I tried that. It helped a little. But then another error occured. So I just found a decent distribution (http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/Qt-Builds/) which works properly so far. Thank you for your help anyway.

  • [quote author="ted_kingdom" date="1358208657"]error: LNK1104: cannot open file 'gdi32.lib'[/quote]

    Hi! Possible during the installation was removed libs system variable "PATH". If the command line does not load calculator (win + R -> cmd -> calc), and empty "PATH" variable when calling the command "set". The solution for me was to System Restore, and reinstalling Visual Studio + Qt

  • Hi, can someone give me a hand with this? I am also getting this error. I was using qt5.0.1 32 bit with MSVC2010 compiler and works great. I wanted to make a 64bit version of my app so I noticed there was a Qt 5.0.2 64bit version available for MSVC2012.
    I downloaded this Qt 5.0.2 version and installed VS 2012 EXP hoping I could now compile a 64bit app.

    I open my project, try and compile, and I get this error: LINK : fatal error LNK1104: cannot open file 'gdi32.lib'
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\x86_amd64\link.EXE"' :

    What might I do to get this work?

  • Hi,

    Is this issue still open?

    I had the same issue, and fixed it easily. gdi32.lib is in the Windows SDK. For Qt 5.0.2 using MSVC2012, you need to have the Microsoft Windows 8 SDK. It's possible that you have the Windows 7 SDK, in which case you will have the gdi32.lib but the compiler won't find it.

    You can check if this is the problem by going to the Windows SDK directory and taking a look. Usually it's here:

    C:\Program Files (x86)\Microsoft SDKs\Windows

    There will likely be the v7.0A directory. You need the v8.0 and v8.0A directories to be there. If they are missing, get the SDK from here:


    Download and install the Windows 8 SDK and it should just work.


  • Banned

    This post is deleted!

Log in to reply