I am trying to detect a XBOX 360 controller in a port but all i get is a lot of error
Hello I am trying to write a program that uses a controller to emulate key presses and mouse clicks and movements. I thought that this would be a cool program so that I could add in XBOX 360 controller support to games that have none.
Here is my entire code(note how I have just gotten started on this progect)
Code:
#include <stdio.h>
#include <Xinput.h>
#define FALSE 0
#define TRUE 0
void main()
{
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");
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");
}
BYTE ControllerExists()
{
for (BYTE i = 0; i < 4; i++)
{
XINPUT_STATE state;
ZeroMemory(&state, sizeof(XINPUT_STATE));
if (XInputGetState(0, &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;
}
When I compile this code I get the following 11 errors.
Error 1 error C1189: #error : "No Target Architecture" c:\program files (x86)\windows kits\8.1\include\um\winnt.h 145 1 Joystick Key Mapper
2 IntelliSense: #error directive: "No Target Architecture" c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 145 2 Joystick Key Mapper
3 IntelliSense: identifier "PCONTEXT" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 9017 5 Joystick Key Mapper
4 IntelliSense: identifier "PCONTEXT" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 16918 11 Joystick Key Mapper
5 IntelliSense: identifier "PSLIST_HEADER" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 17529 11 Joystick Key Mapper
6 IntelliSense: identifier "SLIST_HEADER" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 17537 16 Joystick Key Mapper
7 IntelliSense: identifier "PSLIST_HEADER" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 17544 13 Joystick Key Mapper
8 IntelliSense: identifier "PSLIST_HEADER" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 17551 13 Joystick Key Mapper
9 IntelliSense: identifier "PSLIST_HEADER" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 17559 13 Joystick Key Mapper
10 IntelliSense: identifier "PSLIST_HEADER" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 17569 13 Joystick Key Mapper
11 IntelliSense: identifier "PSLIST_HEADER" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h 17576 10 Joystick Key Mapper
If you know what these errors mean and how I can fix them please say so. Thank you for taking the time to read this
JustinWeq,