Results 1 to 5 of 5

Thread: Static Linking Qt with openCV

  1. #1
    Join Date
    Sep 2013
    Posts
    44
    Thanks
    9
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Static Linking Qt with openCV

    I just downloaded openCV and built it using cmake, making sure to uncheck 'build sharedlibs' option.
    I want to build an exe that has all the dlls required for openCV to work .
    after writing a code, unless I put the opencv core dll in the same folder as my application , the application doesn't work.
    also , none of the highgui functions seem to work.
    what am I doing wrong ?

    my .pro file :
    Qt Code:
    1. QT += core
    2.  
    3. QT -= gui
    4. LIBS += -Wl,-Bstatic -Wl,-Bdynamic
    5. TARGET = untitled4
    6. CONFIG += console
    7. CONFIG -= app_bundle
    8.  
    9. TEMPLATE = app
    10. CONFIG += -static -static-libgcc
    11.  
    12. SOURCES += main.cpp
    13. INCLUDEPATH +=C:\opencv\install\include
    14.  
    15. LIBS+= G:\opencv\build\x86\vc11\bin\bin\libopencv_core247.dll
    16. LIBS+= G:\opencv\build\x86\vc11\bin\bin\libopencv_highgui247.dll
    17.  
    18. RESOURCES += \
    19. test.qrc
    To copy to clipboard, switch view to plain text mode 
    I tried static building option in cmake, and changing the name from .dll to .a, but its always the same problem .

    I am using a static version of Qt
    I followed this tutorial :
    http://stackoverflow.com/questions/1...use-qt-library

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Static Linking Qt with openCV

    You are currently explicitly telling the linker to use the dynamic link library for the two OpenCV libraries so it is unsurprising that you get that. If you use the *.a file and still get linked to the DLLs then you have a dynamic library build of OpenCV.

    Check for differently named static versions of the libraries, or diagnose why you are not getting a static build of OpenCV. If you previously had a dynamic build and did not completely clean it out when switching to staic then that would be a likely factor.

  3. #3
    Join Date
    Sep 2013
    Posts
    44
    Thanks
    9
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Re: Static Linking Qt with openCV

    I am using Cmake, how do I make a static build of openCv?
    I tried unchecking the option 'build shared libs' in cmake gui, but it didn't seem to help

    EDIT:
    in the build folder, I can see a folder called staticlib, is that the folder to use ?
    its full of .pdb and .lib files
    Last edited by harvey_slash; 16th December 2013 at 12:17.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Static Linking Qt with openCV

    I cannot tell you from first hand experience. I do not have a statically built OpenCV and do not propose building one just to find out.

    http://stackoverflow.com/questions/7...-cmake-options

    If you are using GCC the the *.lib files are almost certainly not the result of your build. They are likely to be suitable for use with Microsoft's compiler.

  5. #5
    Join Date
    Sep 2013
    Posts
    44
    Thanks
    9
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Re: Static Linking Qt with openCV

    That didn't work .


    okay, first error :
    libgcc_s_sjlj-1.dll missing

    libstdc++-6.dll missing
    libgcc_s_dw2-1 missing

    after I add all these dlls , I get




    The procedure entry point -ZNSt8_setail15_List_node_base7_M_hookEPS0_ could not be located in the dynamic link library D:\Test\libopencv_highgui247.dll

Similar Threads

  1. linking with opencv
    By karuna in forum General Programming
    Replies: 2
    Last Post: 27th February 2013, 11:24
  2. [OpenCV] Linking problem
    By danioto in forum Newbie
    Replies: 3
    Last Post: 1st November 2012, 01:33
  3. Replies: 3
    Last Post: 7th February 2012, 10:40
  4. Linking Error Qt OpenCV
    By Songi in forum Installation and Deployment
    Replies: 4
    Last Post: 28th August 2011, 04:03
  5. Replies: 3
    Last Post: 1st June 2011, 15:32

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.