Hello I am getting the following two errors in my program. They are:
Error 1 error LNK2019: unresolved external symbol _XInputGetState@8 referenced in function _ControllerExists F:\Programs\C-flat\Joystick Key Mapper\Joystick Key Mapper\Source.obj Joystick Key Mapper
Error 2 error LNK1120: 1 unresolved externals F:\Programs\C-flat\Joystick Key Mapper\Debug\Joystick Key Mapper.exe Joystick Key Mapper
Here is my program:
Code:
#define _X86_
#include <stdio.h>
#include<string.h>
#include <Xinput.h>
#include <stdbool.h>
#include <Windows.h>
BYTE ControllerExists();
int main()
{
char option;
puts("Welcome to Key Mapper \n");
puts("Program by: Jeremy Red\n");
puts("Information:\n");
if (ControllerExists() > FALSE);
{
puts("Controller Found");
}
puts("Program is used to map keys to a controller input\n");
while (1 == 1)
{
puts("Select type in an option:\n\n");
puts("\t 1. <L>oad a program\n");
puts("\t 2. <S>tart a new program\n");
puts("\t 3. <E>dit an existing program\n");
puts("\t 4. <R>un current program\n");
puts("\t 5. <Q>uit preogram\n");
option = getchar();
if (option == '1' || option == 'L' || option == 'l')
{
// Load an existing program
}
else
if (option == '2' || option == 'S' || option == 's')
{
// Start a new program
}
else
if (option == '3' || option == 'E' || option == 'e')
{
// Change an existing program
}
else
if (option == '4' || option == 'R' || option == 'r')
{
// Run the current program and if one is not running
// return an error and reload options
}
else
if (option == '5' || option == 'Q' || option == 'q')
{
return EXIT_SUCCESS;
}
}
}
BYTE ControllerExists()
{
for (BYTE i = 0; i < 4; i++)
{
XINPUT_STATE state;
ZeroMemory(&state, sizeof(XINPUT_STATE));
if (XInputGetState(i, &state) == TRUE)
{
printf("Controller was found in port %i\n", i);
return i + 1;
}
}
puts("Error no controller was found on any port");
return 0;
}
I have no idea how I can fix this... I know what the error is just not how to fix it. If anyone could help I would appreciate it.