Link to user32.lib in QTCreator

I need the WINAPI function SendInput from user32.lib for my application, and the compiler complains about undefined references to "SendInput".

So I tried linking user32.lib by right-clicking in the project file and then using the dialog to add my file from the Windows SDK. The QT creator added the following lines to my .pro file:

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib/ -lUser32 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib/ -lUser32d else:symbian: LIBS += -lUser32 else:unix: LIBS += -L$$PWD/../../../Program Files (x86)/Microsoft SDKs/Windows /v7.0A/Lib/ -lUser32 INCLUDEPATH += $$PWD/../../../Program Files (x86)/Microsoft SDKs/Windows/v7.0A DEPENDPATH += $$PWD/../../../Program Files (x86)/Microsoft SDKs/Windows/v7.0A 

Unfortunately, although all paths exist, the compiler seems to ignore it.

I keep getting the "Undefined SendInput link". Thanks

+2
source share
1 answer

I solved the problem.

I needed to define WINVER in the .pro file: "DEFINES + =" WINVER = 0x0500 "QT seems to ignore the #define WINVER statements in the header files.

+2
source

All Articles