Results 1 to 4 of 4

Thread: Should i recompile opencv to run under Qt ?

  1. #1
    Join Date
    Jul 2011
    Posts
    16
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Should i recompile opencv to run under Qt ?

    Hello folks,

    I have this very weird problem and wish to get help from you,

    I've downloaded and installed the executable OpenCV 2.1.

    Based on several posting on the this forum, i could set it up. I have the following lines on my .pro

    Qt Code:
    1. INCLUDEPATH += "C:/OpenCV2.1/include/opencv"
    2. LIBS += -L"C:/OpenCV2.1/lib" -lml210 -lcv210 -lml210 -lml210d -lcxcore210 -lcvaux210 -lhighgui210 -lcxts210 \
    3. -lnetapi32
    To copy to clipboard, switch view to plain text mode 

    My code was working for a long time. Now i am trying to use CvEM function from this website the Machine Learning library ml210, but i get an error saying

    undefined reference to CvEM::CvEM()
    The code is available in here http://opencv.willowgarage.com/docum...vEM%3a%3atrain and it works perfectly when I run it under Visual Studio.

    If I comment CvEM em_model the code compiles:

    Qt Code:
    1. // CvEM em_model;
    2. CvEMParams params;
    To copy to clipboard, switch view to plain text mode 
    CvEMParams doesn't result in an error, so I think that the include paths are ok. Does anyone know how to solve this problem?

    Is it possible that the library needs to be recompiled to work under Qt ? But why would other libraries in OpenCV work directly without the need to recompile them ?

    I look forward to hearing from you,

  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: Should i recompile opencv to run under Qt ?

    Qt is not a C++ compiler. Your code example is pure C++ code using OpenCV with an unspecified compiler. From your comment about Visual Studio I assume your compiler is MingW GCC. The error message is from the linker I think, so perhaps you have a missing lib (-l) entry. The libs are called opencv_ml etc. on Linux. Are you sure the libs are called ml210 and not just ml or opencv_ml on Windows? I don't have a Windows version to see if they are named differently.

    You seem to be listing ml210 twice and ml210d (a debug version?) also. Try removing the duplicate and debug version.

    Quote Originally Posted by nackasha View Post
    If I comment CvEM em_model the code compiles:

    Qt Code:
    1. // CvEM em_model;
    2. CvEMParams params;
    To copy to clipboard, switch view to plain text mode 
    CvEMParams doesn't result in an error, so I think that the include paths are ok. Does anyone know how to solve this problem?
    If this compiles and links then em_model is unused and you have already solved the problem. However, the code you linked to uses em_model (unconditionally) and will fail to compile with this line missing. Are you sure it compiles with that line commented?

    Is there a reason you didn't use the latest version (2.3.1)? This may be a bug that is already fixed.

  3. The following user says thank you to ChrisW67 for this useful post:

    nackasha (16th December 2011)

  4. #3
    Join Date
    Jul 2011
    Posts
    16
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Should i recompile opencv to run under Qt ?

    Many thanks Sir. I recompiled OpenCV with MINGW and it worked perfectly

    What keeps me thinking, why did it run for other libraries in OpenCV but not the ml one ? I would love to know the answer to this even though it doesn't matter now as it is working perfectly .

    Best regards

  5. #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: Should i recompile opencv to run under Qt ?

    It must have been built with a MingW toolchain in order to work at all with the compiler suite bundled in the Qt SDK. Perhaps it was built with a slightly different tool chain that generated slightly different outputs only for that library.

  6. The following user says thank you to ChrisW67 for this useful post:

    nackasha (16th December 2011)

Similar Threads

  1. recompile Qt, configure get error.
    By c154387417 in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2011, 09:13
  2. Qt Linguist Is it possible to recompile only the tools?
    By PaladinKnight in forum Qt Tools
    Replies: 2
    Last Post: 7th September 2010, 18:21
  3. Replies: 3
    Last Post: 18th December 2009, 19:04
  4. MSVC2K5 recompile /MT(d)
    By musikit in forum Installation and Deployment
    Replies: 2
    Last Post: 16th April 2008, 12:57
  5. How to recompile
    By vishesh in forum Newbie
    Replies: 1
    Last Post: 24th February 2007, 14:46

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.