今天使用ubuntu11.10编译android4.0出现以下问题:
prebuilt/ndk/android-ndk-r5/platforms/android-9/arch-arm/usr/include/limits.h:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
In file included from external/zlib/gzguts.h:28,
from external/zlib/gzclose.c:6:
prebuilt/ndk/android-ndk-r5/platforms/android-9/arch-arm/usr/include/fcntl.h:1: error: stray '\1' in program
In file included from external/zlib/gzguts.h:56,
from external/zlib/gzclose.c:6:
经调查发现是由于c++编译器的问题,ICS 与ubuntu自带的g++ 4.6不兼容,需要降到g++4.4才行,
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
make编译时选择gcc版本,
make CC=gcc-4.4 CXX=g++-4.4 -j4