سؤال

I'm having trouble compiling some code that utilizes Direct Input 8. Everything else in my code works fine, but when the input code gets compiled this sequence of warnings and errors pops up.

    1>  Input.cpp
    1>c:\program files (x86)\windows kits\8.0\include\um\winuser.h(5826): warning C4091:     'typedef ' : ignored on left of 'tagINPUT' when no variable is declared
    1>c:\program files (x86)\windows kits\8.0\include\um\winuser.h(5826): error C2143: syntax error : missing ';' before ','
    1>c:\program files (x86)\windows kits\8.0\include\um\winuser.h(5826): error C2059: syntax error : ','
    1>c:\program files (x86)\windows kits\8.0\include\um\winuser.h(5833): error C2061: syntax error : identifier 'LPINPUT'

This is in Visual Studio 2012. Any ideas as to what could be causing this? I checked the rest of my code for missing semicolons and commas but I couldn't find anything. Have any of you had a similar problem before?

here are the surrounding lines in winuser.h

#define INPUT_MOUSE     0
#define INPUT_KEYBOARD  1
#define INPUT_HARDWARE  2

typedef struct tagINPUT {
    DWORD   type;

    union
    {
        MOUSEINPUT      mi;
        KEYBDINPUT      ki;
        HARDWAREINPUT   hi;
    };
line 5826 } INPUT, *PINPUT, FAR* LPINPUT;

Current includes in Input.H are

#include<dinput.h>
#include"MemUtils.h"

and Input.cpp only includes Input.H

هل كانت مفيدة؟

المحلول

I had used some macros in my input.h file.

#ifndef INPUT
#define INPUT

This was a critical and stupid mistake that lead to this issue. Sorry about all this.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top