1
votes

I am trying to use the Qt new functions described here: http://opencv.willowgarage.com/documentation/cpp/qt_new_functions.html#cv-createbutton

And I also found this topic on SO: openCV 2.2 createButton LNK 2019 error in Visual Studio 2010 but compiling with QT didn't work.

Anyway, according to my searches it seems to be a linking problem. My doubt is that I already compiled OpenCV (without QT) but I can use the createTrackbar normally.

I tried using the createButton as this:

cv::createButton("buttonCanny",    buttonCallBackCanny,NULL,CV_RADIOBOX,true);

But I get this error:

undefined reference to `cv::createButton(std::string const&, void ()(int, void), void*, int, bool)'

I tried the cvCreateButton but I get the same error.

I have this setup C/C++ Build -> Settings -> Tool Settings -> MingGW C++ Linker -> Libraries (all the .dll from compiled OpenCV)

  • libopencv_calib3d230
  • opencv_ffmpeg
  • libopencv_contrib230
  • libopencv_core230
  • libopencv_features2d230
  • libopencv_flann230
  • libopencv_gpu230
  • libopencv_highgui230
  • libopencv_imgproc230
  • libopencv_legacy230
  • libopencv_ml230
  • libopencv_objdetect230
  • libopencv_video230

C/C++ Build -> Settings -> Tool Settings -> MingGW C++ Linker -> Search Path ("C:\opencvbin\bin" where the Dll are)

C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Includes "C:\OpenCV2.3\build\include"

Any suggestions?

Thank you!

1
Do you also added the Qt DLLs to the project?borges
@borges ok, I added the wrong library, I forgot about C:\QtSDK\QtCreator\bin.. do you know what libraries should I add?mrcaramori

1 Answers

4
votes

Ok, I made some mistakes.

Firstly, I wasn't downloading the source code of QT, only the SDK, without source code. The necessary libs and executables where there.

Secondly, I had to add some entries in the CMake Gui,

I was ignoring this message: Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_LIBRARY)

then, I set

  • QT_QMAKE_EXECUTABLE = C:\Qt\4.8.0\bin\qmake.exe
  • QT_MOC_EXECUTABLE = C:\Qt\4.8.0\bin\moc.exe
  • QT_RCC_EXECUTABLE = C:\Qt\4.8.0\bin\rcc.exe
  • QT_UIC_EXECUTABLE = C:\Qt\4.8.0\bin\uic.exe
  • QT_INCLUDE_DIR = C:\Qt\4.8.0\include

and it worked fine.

Trackbar seems to work without Qt, so they probably use their own implementation of a trackbar when there is no Qt available.

Thanks!