Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt 5.0.2 Error LNK1104: cannot open file 'gdi32.lib'
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 3 Posters 16.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Statik_Z
    wrote on last edited by
    #1

    Hello, I have been watching videos on how to create a program using Qt and I want to try it myself and also, I'm trying to learn how to use Qt because I am interested in making a couple of simple games. I have a pretty basic background knowledge regarding C++. I downloaded the Qt 5.0.2(The Windows 8 64 bit since that's what my laptop runs in) and it all works fine. I tried to make a simple program and when I try to build it, I get this error message:

    LINK : fatal error LNK1104: cannot open file 'gdi32.lib'

    I checked in my C: drive to see if I have a gdi32.lib file and I have it under the library folder which is in the Microsoft SDK folder. I don't know what the problem is. Does it matter if the the .Lib file under the Microsoft SDK is called "Gdi32.Lib," not being exactly named like the one that Qt Creator cannot open? Anything I can do to fix this error?

    I would greatly appreciate any help. Thank you for your time.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Do you have a line like

      @LIBS += -lC:/path_to_sdk/path_to_folder_containing_Gdi32.lib@

      in your pro file ?

      EDIT:add missing -l

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Statik_Z
        wrote on last edited by
        #3

        Thank you.
        No I didn't have that and I included it. The example project didn't give me the LNK1104 error but ended up getting this error:

        16:41:58: The process "C:\Qt\Qt5.0.2\Tools\QtCreator\bin\jom.exe" exited with code 2.
        Error while building/deploying project analogclock (kit: Desktop Qt 5.0.2 MSVC2012 64bit)
        When executing step 'Make'

        and after I tried to recompile to make sure that the LNK1104 error does not appear, it still says the LNK1104 error message. I tried to change the slash direction to see if it made any difference and no luck. I'm sure that I have the gdi32.lib file in there.

        I don't know what would be the difference between building with the debug and building with the release but I get those errors when I build with the debug. When I try building with the release, it gives me this error:

        LNK1181: cannot open input file 'C:\Program.lib'

        I don't know much about Qt and I tried looking for information online but I'm still stuck. /:

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It's because of the "Program Files" space try the same path with

          @LIBS += -l$$quote("C:/Program Files/etc...")@

          If that still doesn't work, get the 8.3 path for Program Files

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Statik_Z
            wrote on last edited by
            #5

            Tried that too and no difference. What's the 8.3 path? What do you mean by that?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              The short version name like in the old dos days

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • M Offline
                M Offline
                MathiasWestin
                wrote on last edited by
                #7

                I've got the same problem, maybe a stupid question but why is it trying to link gdi32.lib when building a x64 project?

                I opened the .pro file from the Qt-examples in Visual Studio 2012 using the add-in
                QT5|Open Qt project file (.pro)...

                At first it complain on manifest:embedded but that can be solved by setting VS not to embed the mainfest: https://bugreports.qt-project.org/browse/QTBUG-30822

                But I only get so far because I get the next error:
                LINK : fatal error LNK1104: cannot open file ‘gdi32.lib’

                If I create a project from scratch instead of importing there is no problem building and running. Also Opening the .pro file in Qt Creator is working fine.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved