为什么链接器给我一个“未定义的引用”错误?

时间:2013-03-23 06:39:57

标签: reference makefile undefined gnu gnu-make

我在构建输出中得到了这个(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/b g_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]错误1~

提前谢谢。

1 个答案:

答案 0 :(得分:0)

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

有关讨论,请参阅Why does the order in which libraries are linked sometimes cause errors in GCC?