multiple definition of ‘***’ between crypto.a and

今天我在编译我的Cocos2dx项目时,它报错说我重复定义了,因为我需要在代码中使用openssl库,就把它添加到了第三方库的文件夹里,之后在编译时,报出错误说是openssl的静态库中一些东东被curl的静态库给定义了,就产生了这个错误,具体报错如下:

/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_set_cipher_list'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_get_shared_ciphers'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'ssl_cipher_list_to_bytes'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'ssl_bytes_to_cipher_list'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_get_servername'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_get_servername_type'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_select_next_proto'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_get0_next_proto_negotiated'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_CTX_set_next_protos_advertised_cb'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_CTX_set_next_proto_select_cb'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: jni/../../cocos2d/external/openssl/armeabi-v7a/lib/libssl.a(ssl_lib.o): multiple definition of 'SSL_CTX_set_alpn_protos'
/home/bob/WorkSpace/Cocox2d/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: jni/../../cocos2d/external/curl/prebuilt/android/armeabi-v7a/libcurl.a(ssl_lib.o): previous definition here

这是一部分的报错,但也能说明问题了,然后我就开始寻找怎么解决它。

最后用的方法是,在/proj.android/jni/Android.mk 文件中,加上下面这句话:

LOCAL_LDFLAGS := -Wl,--allow-multiple-definition

然后,就可以正常编译了,但我不太清楚会不会有什么不好的影响,希望有了解的可以指点一下。

你可能感兴趣的:(multiple definition of ‘***’ between crypto.a and)