Проблема с OpenCV - undefined reference

483
09 февраля 2017, 00:48

Решил изучить OpenCV... Собрал статические библиотеки под MinGW, попробовал запустить простой код отсюда - и получил кучу undefined reference-ов:

g++ -m32    -o dist/Release/MinGW-Windows/testopencv build/Release/MinGW-Windows/TestOpenCV.o -L/D/Programms/MinGW/OpenCV/lib -lopencv_core320 -lopencv_highgui320
build/Release/MinGW-Windows/TestOpenCV.o:TestOpenCV.cpp:(.text.startup+0x40): undefined reference to `cv::imread(cv::String const&, int)'
d:/Programms/MinGW/OpenCV/lib/libopencv_core320.a(persistence.cpp.obj):persistence.cpp:(.text$_ZL12icvCloseFileP13CvFileStorage+0x4b): undefined reference to `gzclose'
d:/Programms/MinGW/OpenCV/lib/libopencv_core320.a(persistence.cpp.obj):persistence.cpp:(.text$_ZL6icvEofP13CvFileStorage+0x3e): undefined reference to `gzeof'
d:/Programms/MinGW/OpenCV/lib/libopencv_core320.a(persistence.cpp.obj):persistence.cpp:(.text$_ZL7icvPutsP13CvFileStoragePKc+0x1f7): undefined reference to `gzputs'
d:/Programms/MinGW/OpenCV/lib/libopencv_core320.a(persistence.cpp.obj):persistence.cpp:(.text$_ZL7icvGetsP13CvFileStoragePci+0xe0): undefined reference to `gzgets'
d:/Programms/MinGW/OpenCV/lib/libopencv_core320.a(persistence.cpp.obj):persistence.cpp:(.text$cvOpenFileStorage+0xe4f): undefined reference to `gzrewind'
d:/Programms/MinGW/OpenCV/lib/libopencv_core320.a(persistence.cpp.obj):persistence.cpp:(.text$cvOpenFileStorage+0x170e): undefined reference to `gzopen'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL15icvRemoveWindowP8CvWindow+0x11b): undefined reference to `SelectObject@8'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL15icvRemoveWindowP8CvWindow+0x126): undefined reference to `DeleteObject@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL15icvRemoveWindowP8CvWindow+0x138): undefined reference to `DeleteDC@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL16icvGetBitmapDataP8CvWindowP7tagSIZEPiPPv.isra.0+0x1e): undefined reference to `GdiFlush@0'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL16icvGetBitmapDataP8CvWindowP7tagSIZEPiPPv.isra.0+0x32): undefined reference to `GetCurrentObject@8'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL16icvGetBitmapDataP8CvWindowP7tagSIZEPiPPv.isra.0+0x6d): undefined reference to `GetObjectA@12'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x2b2): undefined reference to `CreateRectRgn@16'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x2db): undefined reference to `CreateRectRgn@16'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x304): undefined reference to `CreateRectRgn@16'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x322): undefined reference to `CombineRgn@16'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x339): undefined reference to `CombineRgn@16'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x373): undefined reference to `FillRgn@12'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x37e): undefined reference to `DeleteObject@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x389): undefined reference to `DeleteObject@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14MainWindowProcP6HWND__jjl+0x394): undefined reference to `DeleteObject@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x2d9): undefined reference to `SetStretchBltMode@8'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x363): undefined reference to `StretchBlt@44'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x3e5): undefined reference to `CreateCompatibleDC@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x438): undefined reference to `CreateCompatibleBitmap@12'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x457): undefined reference to `SelectObject@8'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x477): undefined reference to `SetStretchBltMode@8'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x4e0): undefined reference to `SetDIBColorTable@16'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x52b): undefined reference to `BitBlt@36'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x542): undefined reference to `DeleteObject@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x551): undefined reference to `DeleteDC@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x5fc): undefined reference to `BitBlt@36'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL11HighGUIProcP6HWND__jjl+0x74f): undefined reference to `SetDIBColorTable@16'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14showSaveDialogP8CvWindow+0x104): undefined reference to `GetSaveFileNameA@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$_ZL14showSaveDialogP8CvWindow+0x483): undefined reference to `cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvInitSystem+0x8f): undefined reference to `GetStockObject@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvInitSystem+0xc3): undefined reference to `GetStockObject@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvNamedWindow+0x204): undefined reference to `CreateCompatibleDC@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvShowImage+0x10b): undefined reference to `SelectObject@8'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvShowImage+0x116): undefined reference to `DeleteObject@4'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvShowImage+0x1a7): undefined reference to `CreateDIBSection@24'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvShowImage+0x1b9): undefined reference to `SelectObject@8'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvShowImage+0x213): undefined reference to `cvConvertImage'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvShowImage+0x2a1): undefined reference to `cvConvertImage'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvShowImage+0x2c1): undefined reference to `cvConvertImage'
d:/Programms/MinGW/OpenCV/lib/libopencv_highgui320.a(window_w32.cpp.obj):window_w32.cpp:(.text$cvShowImage+0x374): undefined reference to `cvConvertImage'
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Release/MinGW-Windows/testopencv.exe] Error 1
make.exe[2]: Leaving directory `/d/Projects/TestOpenCV'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/d/Projects/TestOpenCV'
make.exe": *** [.build-impl] Error 2

Библиотеки: Вроде статические библиотеки... Пробовал линковать всё, что есть в папке с библиотеками. Может я что-то не так подключил или собрал? Чего ему не хватает?

READ ALSO
Декомпиляция приложения в Unreal Engine 4 под Windows [требует правки]

Декомпиляция приложения в Unreal Engine 4 под Windows [требует правки]

Не знаю как редактировать готовое скомпилированное приложениеБыл вариант из скомпилированных файлов сделать проект, но у меня ничего не получилось...

465
как изменить под динамический массив?

как изменить под динамический массив?

не могу переделать под динамический массив, чтобы из файла без проблем можно было любого размера текст использовать в программе ( удаляет...

359
Не коректное чтение значения из std::cin в std::string

Не коректное чтение значения из std::cin в std::string

При считывании потока из командной строки в переменную с помощью std::getline не дает ввести данные, перескакиваетКак можно считать строку с пробелами...

301