[Solved] collect2.exe:-1: error: error: ld returned 1 exit status



  • Hi

    Please help.
    I whant to use openCV in my Qt App for android.

    I added the following paths in .pro file

    ANDROID_OPENCV = C:/openCV/sdk/native

    LIBS +=
    $$ANDROID_OPENCV/libs/armeabi/libopencv_calib3d.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_flann.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_objdetect.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_contrib.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_video.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_ml.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_legacy.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_highgui.a
    $$ANDROID_OPENCV/3rdparty/libs/armeabi/liblibjpeg.a
    $$ANDROID_OPENCV/3rdparty/libs/armeabi/liblibpng.a
    $$ANDROID_OPENCV/3rdparty/libs/armeabi/liblibtiff.a
    $$ANDROID_OPENCV/3rdparty/libs/armeabi/liblibjasper.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_ts.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_imgproc.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_core.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_androidcamera.a
    $$ANDROID_OPENCV/libs/armeabi/libopencv_features2d.a

    INCLUDEPATH += $$ANDROID_OPENCV/jni/include/opencv/
    INCLUDEPATH += $$ANDROID_OPENCV/jni/include/opencv2/
    INCLUDEPATH += $$ANDROID_OPENCV/jni/include/

    When I comile project I get the following error

    collect2.exe:-1: error: error: ld returned 1 exit status


  • Lifetime Qt Champion

    Hi,

    You need to post the complete error log, with this only line it's impossible to help you



  • This is what I copied from Compile Output

    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrDecoder::ExrDecoder(): error: undefined reference to 'Imf::Chromaticities::Chromaticities(Imath::Vec2<float> const&, Imath::Vec2<float> const&, Imath::Vec2<float> const&, Imath::Vec2<float> const&)'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrDecoder::readHeader(): error: undefined reference to 'Imf::globalThreadCount()'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrDecoder::readHeader(): error: undefined reference to 'Imf::InputFile::InputFile(char const*, int)'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrDecoder::readHeader(): error: undefined reference to 'Imf::InputFile::header() const'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrDecoder::readHeader(): error: undefined reference to 'Imf::chromaticities(Imf::Header const&)'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&): error: undefined reference to 'Imf::OutputFile::OutputFile(char const*, Imf::Header const&, int)'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&): error: undefined reference to 'Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&): error: undefined reference to 'Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrDecoder::readData(cv::Mat&): error: undefined reference to 'Imf::InputFile::setFrameBuffer(Imf::FrameBuffer const&)'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrDecoder::readData(cv::Mat&): error: undefined reference to 'Imf::InputFile::readPixels(int, int)'
    C:/openCV/sdk/native/libs/armeabi/libopencv_highgui.a(grfmt_exr.cpp.o):grfmt_exr.cpp:function cv::ExrDecoder::readData(cv::Mat&): error: undefined reference to 'Imf::InputFile::readPixels(int, int)'
    collect2.exe: error: ld returned 1 exit status


  • Lifetime Qt Champion

    Looks like you are not linking the OpenExr library



  • I only need openCV.
    Why I should link openExp library ?



  • You use "OpenCV":http://opencv.org/ that was built with "OpenExr":http://www.openexr.com/ support.
    But you did not provided a path to OpenExr library.



  • Thank you. I will try to do it!




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.