C、 Android NDK:导入包含缺少声明的自己的input.h版本

C、 Android NDK:导入包含缺少声明的自己的input.h版本,android,c,android-ndk,java-native-interface,cygwin,Android,C,Android Ndk,Java Native Interface,Cygwin,我正在尝试从pocketmagic.net获取Eventinjector项目 这意味着使用用C编写的预编码jni库。我的问题是,当我试图编译本机代码时,会出现一些构建错误。错误日志很长,我相信所有的错误都是一样的,因此我只发布其中的一部分 jni/EventInjector.h:718:9: error: (near initialization for 'mt_tool_labels[0].value') jni/EventInjector.h:719:9: error: 'M

我正在尝试从pocketmagic.net获取Eventinjector项目

这意味着使用用C编写的预编码jni库。我的问题是,当我试图编译本机代码时,会出现一些构建错误。错误日志很长,我相信所有的错误都是一样的,因此我只发布其中的一部分

    jni/EventInjector.h:718:9: error: (near initialization for 'mt_tool_labels[0].value')
    jni/EventInjector.h:719:9: error: 'MT_TOOL_PEN' undeclared here (not in a function)
    jni/EventInjector.h:719:9: error: initializer element is not constant
    jni/EventInjector.h:719:9: error: (near initialization for 'mt_tool_labels[1].value')
    jni/EventInjector.h:720:9: error: 'MT_TOOL_MAX' undeclared here (not in a function)
    jni/EventInjector.h:720:9: error: initializer element is not constant
    jni/EventInjector.h:720:9: error: (near initialization for 'mt_tool_labels[2].value')
    jni/EventInjector.c: In function 'debug':
    jni/EventInjector.c:82:2: error: format not a string literal and no format arguments [-                        Werror=format-security]
    cc1.exe: some warnings being treated as errors

    make: *** [obj/local/armeabi/objs/EventInjector/EventInjector.o] Error 1
翻阅博客帖子下的评论,我发现“亚历山德罗”也有同样的问题,但找到了解决办法。(post 51)“我也有同样的问题,并导入了我自己的input.h版本,其中包含所有缺失的声明。”

这是.c文件中生成大多数错误的部分:

    static struct label key_labels[] = {
    LABEL(KEY_RESERVED),
    LABEL(KEY_ESC),
    LABEL(KEY_1),
    LABEL(KEY_2),
    LABEL(KEY_3),
    LABEL(KEY_4),
    LABEL(KEY_5),
    LABEL(KEY_6),
    LABEL(KEY_7),
    LABEL(KEY_8),
    LABEL(KEY_9),
    LABEL(KEY_0),
    LABEL(KEY_MINUS),
    LABEL(KEY_EQUAL),
    LABEL(KEY_BACKSPACE),

我没有C方面的经验,也不知道他是什么意思。所以我的问题是:我该怎么做

我已经使用NDKV9和cygwin成功地编译了其他JNI库,所以我的设置和环境应该没有问题

我也遇到了同样的问题,并导入了我自己的input.h版本,其中包含所有缺少的声明


您可以做同样的事情并替换input.h(您可以在linux内核源代码中用那些未定义的标识符搜索input.h),但更简单的方法是从EventInjector.h中删除包含未定义标识符的行。只要在eclipse中注释所有突出显示红色的行,它就应该可以工作。

按照您的建议进行了构建。还是不管用的思想。