Android NDK C#ifndef问题

Android NDK C#ifndef问题,android,c,android-ndk,c-preprocessor,conditional-compilation,Android,C,Android Ndk,C Preprocessor,Conditional Compilation,我正在Windows上使用NDK-r6,希望编译一个简单的C程序,用于测试目的。 仅仅编译一个C控制台程序并不是那么容易,但我得到了所需的选项。 我使用的命令行是(在cygwin中): 这是一条很好的命令行,但它很有效。问题是,此代码会中断: #ifndef uint32_t typedef unsigned int uint32_t; #endif #ifndef uint8_t typedef unsigned char uint8_t; #endif 以下是错误: In file in

我正在Windows上使用NDK-r6,希望编译一个简单的C程序,用于测试目的。 仅仅编译一个C控制台程序并不是那么容易,但我得到了所需的选项。 我使用的命令行是(在cygwin中):

这是一条很好的命令行,但它很有效。问题是,此代码会中断:

#ifndef uint32_t
typedef unsigned int uint32_t;
#endif

#ifndef uint8_t
typedef unsigned char uint8_t;
#endif
以下是错误:

In file included from F:/android_ws/stkeys/jni/stkeys.c:44:
F:/android_ws/stkeys/jni/sha1.h:23: error: redefinition of typedef 'uint32_t'
F:/android/android-ndk-r6/platforms/android-5/arch-arm/usr/include/stdint.h:53:
note: previous declaration of 'uint32_t' was here
F:/android_ws/stkeys/jni/sha1.h:27: error: redefinition of typedef 'uint8_t'
F:/android/android-ndk-r6/platforms/android-5/arch-arm/usr/include/stdint.h:49:
note: previous declaration of 'uint8_t' was here
我通过在stdint.h中注释uint32_t等的定义来编译它,但这不是解决方案。
这是NDK中的一个bug,还是我在这里做错了什么?

它显然不希望包含stdint.h。不知道为什么

测试
#ifndef
仅适用于测试已定义的内容。无法有条件地执行
typedef
s


我宁愿破解应用程序代码,也不愿破解标准标题。:-)

这是我获取代码的路径。它不是真正的jni代码。那里只有stkeys.csha1.c和sha1.h文件
In file included from F:/android_ws/stkeys/jni/stkeys.c:44:
F:/android_ws/stkeys/jni/sha1.h:23: error: redefinition of typedef 'uint32_t'
F:/android/android-ndk-r6/platforms/android-5/arch-arm/usr/include/stdint.h:53:
note: previous declaration of 'uint32_t' was here
F:/android_ws/stkeys/jni/sha1.h:27: error: redefinition of typedef 'uint8_t'
F:/android/android-ndk-r6/platforms/android-5/arch-arm/usr/include/stdint.h:49:
note: previous declaration of 'uint8_t' was here