我正在尝试编译我的 cocos2d-x 项目,但是当我运行 build_native.sh 时出现此错误:
/Users/default/Documents/Development/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/game_shared/__/__/Classes/3rdParty/zlib-1.2.3/minigzip.o: multiple definition of 'main'
/Users/default/Documents/Development/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/game_shared/__/__/Classes/3rdParty/zlib-1.2.3/example.o: previous definition here
/Users/default/Documents/Development/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/tiff.a(mkg3states.o): multiple definition of 'main'
/Users/default/Documents/Development/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/game_shared/__/__/Classes/3rdParty/zlib-1.2.3/example.o: previous definition here
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libgame.so] Error 1
make: Leaving directory //.....
我可以在没有 zlib 的情况下构建项目,但我需要它。
编辑:
删除example.c后,我得到这个:
/Users/default/Documents/Development/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/tiff.a(mkg3states.o): multiple definition of 'main'
/Users/default/Documents/Development/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/game_shared/__/__/Classes/3rdParty/zlib-1.2.3/minigzip.o: previous definition here
我可以从 cocos2d 中排除 libtiff 还是如何解决这个问题?