Ask Your Question

Revision history [back]

Opencv static link

Today I was tying to build OpenCV for static linking. From CMake GUI set build_shared_libs=off and build with mingw32-make. For now OK, but when try to compile one of my programs, on linking trow many errors:

g++ "-ID:\\Software\\opencv\\build\\include" -O3 -Wall -c -fmessage-length=0 
-o "src\\main.o" "..\\src\\main.cpp" 

g++ 
"-LD:\\Software\\StaticOpencvLibs\\lib" 
"-LD:\\Software\\StaticOpencvLibs\\3rdparty\\lib"
-o StaticTest.exe "src\\main.o" 
-lIlmImf -llibjasper -llibjpeg -llibpng -llibtiff -lzlib 
-lopencv_calib3d_pch_dephelp -lopencv_calib3d246 -lopencv_contrib_pch_dephelp 
-lopencv_contrib246 -lopencv_core_pch_dephelp -lopencv_core246 
-lopencv_features2d_pch_dephelp -lopencv_features2d246 -lopencv_flann_pch_dephelp 
-lopencv_flann246 -lopencv_gpu_pch_dephelp -lopencv_gpu246 -lopencv_haartraining_engine 
-lopencv_highgui_pch_dephelp -lopencv_highgui246 -lopencv_imgproc_pch_dephelp 
-lopencv_imgproc246 -lopencv_legacy_pch_dephelp -lopencv_legacy246 -lopencv_ml_pch_dephelp 
-lopencv_ml246 -lopencv_nonfree_pch_dephelp -lopencv_nonfree246 
-lopencv_objdetect_pch_dephelp -lopencv_objdetect246 -lopencv_photo_pch_dephelp 
-lopencv_photo246 -lopencv_stitching_pch_dephelp -lopencv_stitching246 
-lopencv_superres_pch_dephelp -lopencv_superres246 -lopencv_ts_pch_dephelp -lopencv_ts246 
-lopencv_video_pch_dephelp -lopencv_video246 -lopencv_videostab_pch_dephelp 
-lopencv_videostab246 

undefined reference to `gzclose'  
undefined reference to `gzgets'    
undefined reference to `gzeof'    
undefined reference to `gzputs'    
undefined reference to `gzopen'    
undefined reference to `gzrewind'   
undefined reference to `SelectObject@8'
undefined reference to `DeleteObject@4'
undefined reference to `DeleteDC@4'
undefined reference to `GdiFlush@0'
undefined reference to `GetCurrentObject@8'
undefined reference to `GetObjectA@12'
undefined reference to `CreateToolbarEx@52'
undefined reference to `SetStretchBltMode@8'
undefined reference to `StretchBlt@44'
undefined reference to `BitBlt@36'
undefined reference to `SetDIBColorTable@16'
undefined reference to `CreateRectRgn@16'
undefined reference to `CreateRectRgn@16'
undefined reference to `CreateRectRgn@16'
undefined reference to `CombineRgn@16'
undefined reference to `CombineRgn@16'
undefined reference to `FillRgn@12'
undefined reference to `DeleteObject@4'
undefined reference to `DeleteObject@4'
undefined reference to `DeleteObject@4'
undefined reference to `GetClipBox@8'
undefined reference to `GetDCOrgEx@8'
undefined reference to `GetStockObject@4'
undefined reference to `GetStockObject@4'
undefined reference to `CreateCompatibleDC@4'
undefined reference to `SelectObject@8'
undefined reference to `DeleteObject@4'
undefined reference to `CreateDIBSection@24'
undefined reference to `SelectObject@8'