Results 1 to 4 of 4

Thread: Mixing static and dynamic libraries using Qt Creator

  1. #1
    Join Date
    Feb 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Mixing static and dynamic libraries using Qt Creator

    I have a static Qt build. I am trying to use openCV shared libraries with statically linked Qt and standart c libraries. I couldn'yt figure how to do that.

    Here is my .pro fileprofile.PNG


    If i compile this code: main_without_cv.PNG

    resulting .exe works correctly without asking any .dlls.

    But if i use openCV library and compile this code:

    with_cv.PNG

    resulting .exe asks for both "libopencv_core2410.dll" and other standart libraries like "libgcc_s_dw2-1.dll"

    What i want is make it ask only for opencv shared libraries. Any help will be appreciated. Sorry for my bad English.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Mixing static and dynamic libraries using Qt Creator

    You can't do that unless you compile the c++ runtime from MinGW statically into the opencv dll. Which is probably out of scope of this forum.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Mixing static and dynamic libraries using Qt Creator

    Thanks! I've compiled opencv statically and problem was solved.

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

    Default Re: Mixing static and dynamic libraries using Qt Creator

    Hi, can you explain how you static compile opencv for qt. In cmake when i set BUILD_SHARED_LIBS=off i got this error Make Error at apps/haartraining/CMakeLists.txt:37 (add_library):
    Target "opencv_haartraining_engine" links to itself.
    And then in vs when i compile opencv i got lot of this errors:
    Error 45 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QMutex::QMutex(enum QMutex::RecursionMode)" (__imp_??0QMutex@@QAE@W4RecursionMode@0@@Z) referenced in function "void __cdecl `dynamic initializer for 'mutexKey''(void)" (??__EmutexKey@@YAXXZ) C:\ocv\myocv\apps\annotation\opencv_highgui2411.li b(window_QT.obj) opencv_annotation
    I use staticly compile Qt 5.4.1 with mingw32 and opencv 2.4.
    Thanks for any help

Similar Threads

  1. static and dynamic libraries linking
    By buddax2 in forum Newbie
    Replies: 2
    Last Post: 27th December 2010, 15:55
  2. Static and Dynamic Libraries
    By waynew in forum Newbie
    Replies: 29
    Last Post: 1st December 2010, 02:29
  3. Mixing static and dynamic Qt builds.
    By End in forum Newbie
    Replies: 3
    Last Post: 2nd March 2010, 22:04
  4. Replies: 17
    Last Post: 26th January 2010, 20:21
  5. having both static and dynamic libraries?
    By gfunk in forum Qt Programming
    Replies: 2
    Last Post: 7th May 2007, 07:33

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.