1

我在编译一些使用 Direct Input 8 的代码时遇到问题。我的代码中的其他所有内容都可以正常工作,但是当编译输入代码时,会弹出这一系列警告和错误。

    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'

这是在 Visual Studio 2012 中。关于可能导致这种情况的任何想法?我检查了我的其余代码是否缺少分号和逗号,但我找不到任何东西。你们以前有过类似的问题吗?

这是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;

Input.H 中的电流包括

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

Input.cpp 只包含 Input.H

4

1 回答 1

2

我在 input.h 文件中使用了一些宏。

#ifndef INPUT
#define INPUT

这是导致这个问题的一个严重而愚蠢的错误。对这一切感到抱歉。

于 2014-04-19T00:41:06.013 回答