Typedef警告和语法错误LPINPUT

时间:2014-04-17 20:36:24

标签: c++ visual-studio-2012 compiler-errors compiler-warnings directinput

我在编译一些使用直接输入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

1 个答案:

答案 0 :(得分:2)

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

#ifndef INPUT
#define INPUT

这是导致这个问题的一个关键且愚蠢的错误。抱歉这一切。

相关问题