Results 1 to 2 of 2

Thread: Opencv with static qt

  1. #1
    Join Date
    Feb 2015
    Posts
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Opencv with static qt

    Hi everyone,i am a newbie. I was start learning c++ 4 mounts ago, and 2 mounts ago i found qt. Now i want to learn how to build static apps with custom libs and i stacks here.That custom library is opencv, and i trying to build static application with opencv.
    In cmake,when i configure opencv for building , i was set BUILD_SHARED_LIBS=off and after that ,when i build opencv, i include these opencv static libs in my project:
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = untitled13
    TEMPLATE = app
    CONFIG += static

    SOURCES += main.cpp\
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    INCLUDEPATH +=C:\opencv\myocv\install\include

    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libIlmImf.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ liblibjasper.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ liblibjpeg.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ liblibpng.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ liblibtiff.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_calib3d2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_contrib2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_core2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_features2d2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_flann2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_gpu2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_highgui2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_imgproc2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_legacy2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_ml2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_nonfree2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_objdetect2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_ocl2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_photo2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_stitching2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_superres2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_ts2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_video2411.a
    LIBS+=C:\opencv\myocv\install\x64\mingw\staticlib\ libopencv_videostab2411.a
    And when i try to compile application i got this errors:
    grfmt_tiff.cpp:-1: error: undefined reference to `TIFFClose'
    grfmt_tiff.cpp:-1: error: undefined reference to `TIFFOpen'
    :-1: error: C:\opencv\myocv\install\x64\mingw\staticlib\libope ncv_highgui2411.a(grfmt_tiff.cpp.obj): bad reloc address 0x2c in section `.text$_ZN2cv11TiffDecoder10readHeaderEv'
    :-1: error: final link failed: Invalid operation
    collect2.exe:-1: error: error: ld returned 1 exit status

    Does someone have experience with this problem.
    Thanks a lot.

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Opencv with static qt

    Are the 2nd through 5th static library names correct? You have liblib prefixes and everything else is prefixed with lib.

Similar Threads

  1. Problem with opencv in static mode
    By oneirics in forum Newbie
    Replies: 5
    Last Post: 18th May 2015, 21:05
  2. Static Linking Qt with openCV
    By harvey_slash in forum Newbie
    Replies: 4
    Last Post: 17th December 2013, 08:36
  3. Replies: 1
    Last Post: 29th June 2013, 16:23
  4. Replies: 3
    Last Post: 1st June 2011, 15:32
  5. Replies: 4
    Last Post: 14th February 2006, 21:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.