Having trouble adding User32.lib to project as linked library.
-
wrote on 21 Oct 2016, 21:00 last edited by Crag_Hack
Hi I am trying to add User32.lib to my QT Creator project and am having difficulties. I have the Windows 10 SDK installed. I tried these in the pro file:
LIBS += -L"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.14393.0/um/x86" -lUser32 LIBS += -luser32
Also verified these in the build environment INCLUDE and LIB variables respectively:
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um; C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\um\x86;
I tried right clicking the project and clicking add library too without success. The library shows up red as here:
Any ideas?
Thanks
-
Hi,
user32 is typically a lib that you shouldn't need to pass a path for. So I'd remove the
-L
option from your .pro file.In any case, are you using a 32 or 64 bit Qt ? Whith which compiler ?
-
wrote on 21 Oct 2016, 21:50 last edited by
Thanks SGaist... using 32 bit QT Creator with Microsoft Visual C++ Compiler 14.0 (x86)
-
It's the Qt version you use to build your application that is important, not the Qt Creator version.
-
wrote on 21 Oct 2016, 23:17 last edited by Crag_Hack
Sorry ... QT is using MSVC 2013 32 bit according to QT Creator. I installed from the Windows online installer and checked both options for MSVC 2015 32 and 64 bit when installing.
-
wrote on 21 Oct 2016, 23:30 last edited by
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.
-
For which architecture are you building ?
-
wrote on 22 Oct 2016, 19:47 last edited by
You mean Windows right?
-
No, I mean x86 vs x86_64
-
wrote on 22 Oct 2016, 19:55 last edited by
Or do you mean... x86/x64? In which case I'm doing x86 since the 64 bit QT Creator kit is broken.
-
wrote on 22 Oct 2016, 20:03 last edited by
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. -
wrote on 22 Oct 2016, 20:04 last edited by
Something's up then cause I already tried that..
-
Qt Creator is 32bit but that has no influence on the version of Qt you are using.
-
wrote on 22 Oct 2016, 20:10 last edited by Crag_Hack
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 -
Then also a silly question but, when you installed Visual Studio 2015, did you install the C++ stuff ? It's not selected by default.
-
wrote on 23 Oct 2016, 05:46 last edited by
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?
-
Did you check in Qt Creator that it detects the compilers ?
-
wrote on 23 Oct 2016, 20:28 last edited by
-
So that part is good. What about the Kits ?
-
wrote on 23 Oct 2016, 20:52 last edited by
6/25