Ask Your Question

Unable to locate library file (running OpenCV4.1.2 using pre-built binaries and CodeLite on Windows)

asked 2019-12-10 11:40:35 -0600

IPG gravatar image
  • OS: Windows 10 Pro (64 bit)
  • OpenCV version: 4.1.2
  • CodeLite: 13.0.4
  • MingW-64: x86_64-8.1.0-posix-seh-rt_v6-rev0
  1. Downloaded and extracted prebuilt binariy from opencv releases windows
  2. In CodeLite - Project settings - Added "C:\opencv\build\include" to the Include paths (under compiler), ".;C:\opencv\opencv\build\x64\vc15\lib" to Libraries search path (under linker) and "opencv_world412d.lib" to Libraries (under linker).


#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;

int main() {
    Mat img = imread("E:\\image.jpg");
    if (! {
        std::cout<<"Image not loaded";
        return -1;
    imshow("img", img);
    return 0;

On Build, I get the following error message, that the Library file opencv_world is not found. Could you pl help.

C:\Windows\system32\cmd.exe /C C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ ABCDE - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/username/Desktop/ABCDE/ABCDE/ABCDE'
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/g++.exe  -c  "C:/Users/username/Desktop/ABCDE/ABCDE/ABCDE/main.cpp" -g -O0 -Wall  -o Debug/main.cpp.o -I. -I. -IC:\opencv\opencv\build\include
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/g++.exe -o Debug/ABCDE @"ABCDE.txt" -L. -L. -LC:\opencv\opencv\build\x64\vc15\lib  -lopencv_world412d.lib
C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lopencv_world412d.lib
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [ Debug/ABCDE] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/username/Desktop/ABCDE/ABCDE/ABCDE'
mingw32-make.exe: *** [Makefile:5: All] Error 2
====0 errors, 0 warnings====
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-12-10 11:50:22 -0600

berak gravatar image

you cannot use the prebuilt libs(.lib) with mingw, those were built for visual studio only.

either switch your compiler toolchain, or you'll have to build libs from src for mingw

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-12-10 11:40:35 -0600

Seen: 1,146 times

Last updated: Dec 10 '19