Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help linking static OpenCV libraries in Qt Creator on Windows
    text
    copied!<p>I have no problem linking the dynamic opencv libraries, but I want to use static libraries instead, so I rebuilt OpenCV 2.3 with the "build shared libraries" option unchecked. I put the following on my .pro file</p> <pre><code>LIBS += "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_calib3d231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_contrib231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_core231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_features2d231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_flann231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_gpu231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_imgproc231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_legacy231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_ml231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_objdetect231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_ts231.a" \ "C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_video231.a" INCLUDEPATH += "C:\Program Files\openCV_static\opencv\build\install\include" INCLUDEPATH += "C:\Program Files\openCV_static\opencv\build\install\include\opencv" </code></pre> <p>This is very similar to what I had before when I was using the dynamic libraries, except the .a files actually ended in .dll .a, and I put the dll's (not the dll.a files) in the qt program's output directory (so the program could find them and run). Now the whole point is that I don't need those dlls, so they're no longer in my program's output directory (actually they didn't build with OpenCV). But I get these errors when I try to build my program:</p> <pre><code>C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a(cap_vfw.obj):cap_vfw.cpp:(.text$_ZN17CvVideoWriter_VFW5closeEv+0x13): undefined reference to `AVIStreamRelease@4' C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a(cap_vfw.obj):cap_vfw.cpp:(.text$_ZN17CvVideoWriter_VFW5closeEv+0x25): undefined reference to `AVIStreamRelease@4' C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a(cap_vfw.obj):cap_vfw.cpp:(.text$_ZN17CvVideoWriter_VFW5closeEv+0x37): undefined reference to `AVIFileRelease@4' C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a(cap_vfw.obj):cap_vfw.cpp:(.text$_ZN16CvCaptureCAM_VFW4openEi+0x6c): undefined reference to `capGetDriverDescriptionA@20' C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a(cap_vfw.obj):cap_vfw.cpp:(.text$_ZN16CvCaptureCAM_VFW4openEi+0xb7): undefined reference to `capCreateCaptureWindowA@32' C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a(cap_vfw.obj):cap_vfw.cpp:(.text$_ZN16CvCaptureAVI_VFW9grabFrameEv+0x29): undefined reference to `AVIStreamGetFrame@8' . . . . C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a(grfmt_jpeg2000.obj):grfmt_jpeg2000.cpp:(.text$_ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x17b): undefined reference to `jas_stream_close' C:\Program Files\openCV_static\opencv\build\install\lib\libopencv_highgui231.a(grfmt_jpeg2000.obj):grfmt_jpeg2000.cpp:(.text.startup._GLOBAL__sub_I_C__Program_Files_openCV_static_opencv_modules_highgui_src_grfmt_jpeg2000.cpp+0x4): undefined reference to `jas_init' collect2: ld returned 1 exit status mingw32-make.exe[1]: *** [release\trusion.exe] Error 1 mingw32-make.exe: *** [release] Error 2 23:21:10: The process "C:\MinGW\bin\mingw32-make.exe" exited with code 2. Error while building project trusion (target: Desktop) When executing build step 'Make' </code></pre> <p>I am using MinGW. Compiling the project with the same toolchain used to build opencv. Worked with dynamic libs, as mentioned above. Does not work with static libs.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload