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
Code:
INCLUDEPATH += "C:/OpenCV2.1/include/opencv"
LIBS += -L"C:/OpenCV2.1/lib" -lml210 -lcv210 -lml210 -lml210d -lcxcore210 -lcvaux210 -lhighgui210 -lcxts210 \
-lnetapi32
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
Quote:
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:
Code:
// CvEM em_model;
CvEMParams params;
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,
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
If I comment CvEM em_model the code compiles:
Code:
// CvEM em_model;
CvEMParams params;
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.
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
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.