PDA

View Full Version : unresolved external symbol



davinciomare
23rd September 2016, 22:20
Hi i need help with these type of errors:

tecladoyraton.obj:-1: error: LNK2019: unresolved external symbol __imp__GetAsyncKeyState@4 referenced in function "short __cdecl comprobarTeclas(void)" (?comprobarTeclas@@YAFXZ)

Code:


#include "../headers/tecladoyratonwin.h"
#include <windows.h>

void enviarTecla(int tecla)
{
switch (tecla)
{
case Qt::Key_Return:
tecla = VK_RETURN;
break;
case Qt::Key_Backspace:
tecla = VK_BACK;
break;
case Qt::Key_Escape:
tecla = VK_ESCAPE;
break;
case Qt::Key_Shift:
tecla = VK_SHIFT;
break;
case Qt::Key_CapsLock:
tecla = VK_CAPITAL;
break;
}
keybd_event(tecla, 0, 0, 0);
keybd_event(tecla, 0, KEYEVENTF_KEYUP, 0);
}

void hacerClickDerechoP()
{
mouse_event( MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0 );
}

void hacerClickIzquierdoP()
{
mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
}
void hacerClickDerechoS()
{
mouse_event( MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 );
}

void hacerClickIzquierdoS()
{
mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
}
short comprobarTeclas()
{
short i = 0;
for(i = 0; i < 255; i++){
if(GetAsyncKeyState(i) == -32767)
return i;
}
return 0;
}

Code of header:

#ifndef TECLADOYRATONWIN_H
#define TECLADOYRATONWIN_H
#include <Qt>

void enviarTecla(int tecla);
void hacerClickDerechoP();
void hacerClickIzquierdoP();
void hacerClickDerechoS();
void hacerClickIzquierdoS();
short comprobarTeclas();

Added after 1 7 minutes:

solved it is solved