我在 VLC 应用程序模块的实现中使用 OpenCV 库。
我想使用函数 cvSaveImage,但我得到了很多错误:
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&):grfmt_jpeg.cpp(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x22c): error: undefined reference to 'jpeg_stdio_dest'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&):grfmt_jpeg.cpp(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x26e): error: undefined reference to 'jpeg_write_scanlines'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&):grfmt_jpeg.cpp(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2bc): error: undefined reference to 'jpeg_write_scanlines'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::my_jpeg_load_dht(jpeg_decompress_struct*, unsigned char*, JHUFF_TBL**, JHUFF_TBL**) [clone .constprop.36]:grfmt_jpeg.cpp(.text.unlikely._ZN2cvL16my_jpeg_load_dhtEP22jpeg_decompress_structPhPP9JHUFF_TBLS5_.constprop.36+0x94): error: undefined reference to 'jpeg_alloc_huff_table'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::close():grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder5closeEv+0xa): error: undefined reference to 'jpeg_destroy_decompress'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::readData(cv::Mat&):grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x82): error: undefined reference to 'jpeg_start_decompress'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::readData(cv::Mat&):grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0xf2): error: undefined reference to 'jpeg_read_scanlines'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::readData(cv::Mat&):grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x136): error: undefined reference to 'jpeg_finish_decompress'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::readHeader():grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder10readHeaderEv+0x1e): error: undefined reference to 'jpeg_std_error'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::readHeader():grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder10readHeaderEv+0x52): error: undefined reference to 'jpeg_CreateDecompress'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::readHeader():grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder10readHeaderEv+0x92): error: undefined reference to 'jpeg_stdio_src'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::readHeader():grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder10readHeaderEv+0xa2): error: undefined reference to 'jpeg_read_header'
/home/virginia/workspace/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a//libopencv_highgui.a(grfmt_jpeg.cpp.o): in function cv::JpegDecoder::readHeader():grfmt_jpeg.cpp(.text._ZN2cv11JpegDecoder10readHeaderEv+0x14c): error: undefined reference to 'jpeg_resync_to_restart'
我必须在 Android.mk 文件名为 LOCAL_LDLIBS 的变量中链接 OpenCV 库。
LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
-L/home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/ \
-L/home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/libs/armeabi-v7a/ \
-ltbb -lopencv_core -lopencv_contrib -lopencv_legacy -lopencv_videostab -lopencv_photo -lopencv_stitching -lopencv_objdetect -lopencv_video -lopencv_ml -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_flann -lopencv_imgproc -lopencv_core -ltbb
我认为我必须链接位于 /home/virginia/workspace/OpenCV-2.4.5-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/ 的库: libIlmImf.a liblibjasper.a liblibjpeg.a liblibpng.a liblibtiff.a
但我不知道链接它们的顺序。
拜托,我需要任何帮助!非常感谢!