PDA

View Full Version : The simplest Qt program in Visual Studio that uses GetKeyState?



TriKri
10th May 2010, 14:36
Hi! Can someone please explain to me how I can make a really simple Qt program in Visual Studio, that can call the function GetKeyState in windows.h? I have tried to compile (using a Makefile Project, I guess that is what I have to choose) the smallest Qt program I can think of that uses GetKeyState, but I get an error message when I try to compile, saying "unresolved external symbol __imp__GetKeyState@4". Am I doing this right? Is it Makefile Project I should choose when I make a Visual Studio Qt project? And should I specify something more in order to make the compiler find GetKeyState? The lines that are executed when the project is built are "qmake -project", "qmake", and "nmake".

Thanks in advance

-Kristofer

TriKri
10th May 2010, 14:58
I found the solution: To add "LIBS += User32.Lib" (without quotation signs) to my .pro file, and refrain from running "qmake -project" every time I compile to prevent the .pro file from being overwritten. :)