1

我在构建输出中得到了这个(filter_setup() 在 ./obj/local/armeabi-v7a/libmyapp-dsp.a 中定义,您可以在链接器输出中看到它。为什么 filter_setup 是未定义的引用?

注意:我使用的是 Android NDK,但此时这是一个通用的链接器问题。

/Applications/SDK/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/arm-linux-androideabi-g++ -Wl,-soname,libapplication.so -shared --sysroot =/Applications/SDK/android-ndk-r8d/platforms/android-8/arch-arm ./obj/local/armeabi-v7a/objs-debug/application/src/broov_gui.o ./obj/local/armeabi- v7a/objs-debug/application/src/broov_player.o ./obj/local/armeabi-v7a/objs-debug/application/src/native_main.o ./obj/local/armeabi-v7a/objs-debug/application/ src/video_player.o ./obj/local/armeabi-v7a/objs-debug/application/src/b_sdl.o ./obj/local/armeabi-v7a/objs-debug/application/src/broov_font.o ./obj /local/armeabi-v7a/objs-debug/application/src/broov_queue.o ./obj/local/armeabi-v7a/objs-debug/application/src/ffplay.o ./obj/local/armeabi-v7a/objs -debug/application/src/optimization.o。/obj/local/armeabi-v7a/objs-debug/application/src/subreader.o ./obj/local/armeabi-v7a/objs-debug/application/src/universalchardet.o ./obj/local/armeabi-v7a /objs-debug/application/resources/bg_loading.o ./obj/local/armeabi-v7a/objs-debug/application/resources/dejavu_sans.o ./obj/local/armeabi-v7a/libmyapp-dsp.a ./ obj/local/armeabi-v7a/libfreetype.a ./obj/local/armeabi-v7a/libstlport_static.a ./obj/local/armeabi-v7a/libsdl.so ./obj/local/armeabi-v7a/libsdl_ttf.so ./obj/local/armeabi-v7a/libsdl_image.so ./obj/local/armeabi-v7a/libiconv.so ./obj/local/armeabi-v7a/libuniversalchardet.so ./obj/local/armeabi-v7a/libyuv2rgb .so -no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,- z,now -L/Applications/SDK/android-ndk-r8d/platforms/android-8/arch-arm/usr/lib -lGLESv1_CM -ldl -llog "/Users/nobody/Development/repositories/git-remote/myapp-dolphin/myappDolphin"/"native/ffmpeg/ffmpeg-0.11.1/android/armv6_vfp/libffmpeg.so" -lc -lm -o ./obj/local /armeabi-v7a/libapplication.so /Applications/SDK/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-v7a/objs-debug/application/src/broov_player.o: 在函数 broov_init_global_values( int,int,int,int,int,int,int,int,int,int,int,int,int,int,int):jni/app/src/broov_player.cpp:3414:错误:未定义对“filter_setup”的引用()' collect2: ld 返回 1 退出状态 make:/obj/local/armeabi-v7a/libapplication.so /Applications/SDK/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-v7a/objs-debug/application/src/broov_player.o:在函数 broov_init_global_values(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int):jni/app/src/broov_player.cpp:3414:错误:未定义参考 'filter_setup()' collect2: ld 返回 1 退出状态 make:/obj/local/armeabi-v7a/libapplication.so /Applications/SDK/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-v7a/objs-debug/application/src/broov_player.o:在函数 broov_init_global_values(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int):jni/app/src/broov_player.cpp:3414:错误:未定义参考 'filter_setup()' collect2: ld 返回 1 退出状态 make:int, int, int, int, int, int, int, int, int):jni/app/src/broov_player.cpp:3414: error: undefined reference to 'filter_setup()' collect2: ld returned 1 exit status制作:int, int, int, int, int, int, int, int, int):jni/app/src/broov_player.cpp:3414: error: undefined reference to 'filter_setup()' collect2: ld returned 1 exit status制作:* [obj/local/armeabi-v7a/libapplication.so] 错误1~

先感谢您。

4

1 回答 1

0

链接库的顺序很重要。您可能需要尝试重新排序libapplication.solibmyapp-dsp.a链接行。

有关讨论,请参阅为什么链接库的顺序有时会导致 GCC 中的错误?

于 2013-03-23T06:42:58.407 回答