conflicting types for 'wchar_t'

本文介绍了Android NDK中wchar_t类型的支持情况。针对不同API级别,wchar_t的大小及可用性有所不同。对于API级别9及以上,wchar_t大小为4字节,并提供了大部分宽字符函数;而对于更早的API级别,wchar_t大小为1字节且宽字符函数不可用。

/host/android-ndk-r7/mytoolchain/bin/../sysroot/usr/include/wchar.h:35: error: conflicting types for 'wchar_t'
/host/android-ndk-r7/mytoolchain/bin/../lib/gcc/arm-linux-androideabi/4.4.3/include/stddef.h:323: note: previous declaration of 'wchar_t' was here

Android NDK Dev Guide(from NDK)

USING THE ANDROID TOOLCHAIN AS A STANDALONE COMPILER


5.2/ wchar_t support:
- - - - - - - - - - -

As documented, the Android platform did not really support wchar_t until
Android 2.3. What this means in practical terms is that:

  - If you target platform android-9 or higher, the size of wchar_t is
    4 bytes, and most wide-char functions are available in the C library
    (with the exception of multi-byte encoding/decoding functions and
     wsprintf/wsscanf).

  - If you target any prior API level, the size of wchar_t will be 1 byte
    and none of the wide-char functions will work anyway.

We recommend any developer to get rid of any dependencies on the wchar_t type
and switch to better representations. The support provided in Android is only
there to help you migrate existing code.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值