Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Having trouble adding User32.lib to project as linked library.
Forum Updated to NodeBB v4.3 + New Features

Having trouble adding User32.lib to project as linked library.

Scheduled Pinned Locked Moved Solved General and Desktop
25 Posts 3 Posters 12.6k Views 2 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.
  • C Offline
    C Offline
    Crag_Hack
    wrote on last edited by
    #6

    So a little more background on the situation...

    I switched from MinGW to MSVC2015 as my compiler in QT Creator. I am using QT Creator with Visual Studio 2015 Community to provide the compiler to QT Creator. With MinGW I had no problems. I am now getting this error message upon compile:

    replicator.obj:-1: error: LNK2019: unresolved external symbol __imp__GetLastInputInfo@4 referenced in function "private: void __thiscall Replicator::idleBackup(void)" (?idleBackup@Replicator@@AAEXXZ
    

    with code

    void Replicator::idleBackup()
    {
        LASTINPUTINFO time;
    
        time.cbSize = sizeof(time);
        GetLastInputInfo(&time);
    
        DWORD temp = GetTickCount() - time.dwTime;
    

    Another person from a different site said this was because of the GetLastInputInfo dependency on User32.lib and that I needed to link that library.

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

      For which architecture are you building ?

      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
      • C Offline
        C Offline
        Crag_Hack
        wrote on last edited by
        #8

        You mean Windows right?

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

          No, I mean x86 vs x86_64

          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
          • C Offline
            C Offline
            Crag_Hack
            wrote on last edited by
            #10

            Or do you mean... x86/x64? In which case I'm doing x86 since the 64 bit QT Creator kit is broken.

            1 Reply Last reply
            0
            • hskoglundH Online
              hskoglundH Online
              hskoglund
              wrote on last edited by
              #11

              Hi, I just tested on my Windows 10 with 32-bit MSVC2015, and to avoid that linker error you only have to add LIBS += -luser32 to your .pro file.

              1 Reply Last reply
              1
              • C Offline
                C Offline
                Crag_Hack
                wrote on last edited by
                #12

                Something's up then cause I already tried that..

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

                  Qt Creator is 32bit but that has no influence on the version of Qt you are using.

                  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
                  • C Offline
                    C Offline
                    Crag_Hack
                    wrote on last edited by Crag_Hack
                    #14

                    You're talking about my previous remark right? I mean the 64 bit MSVC build kit in QT Creator is broken. see here:
                    https://forum.qt.io/topic/72576/qt-creator-complaining-about-msvc-build-and-run-kit/3
                    D'oh the screenshot no longer works...I''l have to fix that

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

                      Then also a silly question but, when you installed Visual Studio 2015, did you install the C++ stuff ? It's not selected by default.

                      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
                      • C Offline
                        C Offline
                        Crag_Hack
                        wrote on last edited by
                        #16

                        I just did the default install, which didn't install the compilers; I knew because they didn't show up in QT Creator. I followed the instructions as here in comment 3 for question 1 in order to install the compilers. Do you think I need to install more C++ components?

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

                          Did you check in Qt Creator that it detects the compilers ?

                          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
                          • C Offline
                            C Offline
                            Crag_Hack
                            wrote on last edited by
                            #18

                            Yup:

                            alt text

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

                              So that part is good. What about the Kits ?

                              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
                              • C Offline
                                C Offline
                                Crag_Hack
                                wrote on last edited by
                                #20

                                Here 'tis... I am getting the error message from the compiler so it's obviously running. Just the library linking that's freaking out. I could pass verbose to the compiler to see if it gives more information.

                                alt text

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

                                  Then it looks like you are trying to setup a 32bit debugger on your 64bit Qt.

                                  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
                                  • C Offline
                                    C Offline
                                    Crag_Hack
                                    wrote on last edited by Crag_Hack
                                    #22

                                    The selected kit for the project is the first (default) one though.
                                    Desktop QT 5.7.0 MSVC2015 32bit

                                    1 Reply Last reply
                                    0
                                    • C Offline
                                      C Offline
                                      Crag_Hack
                                      wrote on last edited by
                                      #23

                                      I'll try verbose to see if there's any more info. If not I might just witch to Visual Studio. Any major functional trade-offs to using Visual Studio vs QT Creator? I know about the plugin.
                                      Thanks!

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

                                        Qt Creator is usually simpler to use and setup.

                                        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
                                        • C Offline
                                          C Offline
                                          Crag_Hack
                                          wrote on last edited by
                                          #25

                                          Update: I tried adding line below with success, program compiles now. Any ideas as to why QT Creator is being so ornery? Thanks again for all your help.

                                          #pragma comment (lib, "User32.lib")
                                          
                                          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