Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile OpenCV with CMake and minGW

I can't compile openCV with Cmake and MinGW on windows. I totally don't understand my mistake, please have a look:

Okay i can't post any picture. So here is the error:

CMake Error at cmake/OpenCVUtils.cmake:19 (if):

if given arguments:

"C:/BuildOpenCV" "MATCHES" "^C:/Users/Corentin/Desktop/C_C++/openCV/opencv" "OR" "C:/BuildOpenCV" "MATCHES" "^C:/BuildOpenCV"

Regular expression "^C:/Users/Corentin/Desktop/C_C++/openCV/opencv" cannot compile Call Stack (most recent call first): CMakeLists.txt:281 (ocv_include_directories)

My source directory :C:/Users/Corentin/Desktop/C_C++/openCV/opencv

Where to build binaries : C:/BuildOpenCV

Do you have any idea of what can cause this kind of issue? I'm a new user, i may have forgotten some important details, please forgive me =).

Thanks !

like image 654
Shoz Avatar asked Jul 07 '12 16:07

Shoz


People also ask

Can OpenCV run on 32 bit?

OpenCV is licensed as freeware for PC or laptop with Windows 32 bit and 64 bit operating system.


1 Answers

Surprisingly I had the same error today, and searched on stackoverflow for a solution... ;o)

The answer lies within the second error message: Regular expression "^C:/Users/Corentin/Desktop/C_C++/openCV/opencv" cannot compile

As you, did I name my folder ../C++/..

As the whole path is entered as a regular expression, "+" is interpreted as regex control sequence for "one or more characters". Therefore ++ has no meaning and the expression cannot compile.

The (quick) solution is to rename your directory to cpp or something else without control characters.

From my point of view this is a bug, as there could also be other "control characters" []().*+\{}? (Especially in windows) in a path string i.e Version numbers: OpenCV-2.4.1

I didn't have the time to register myself for reporting the bug, but maybe anyone else has already an account?

like image 99
FSaccilotto Avatar answered Oct 20 '22 15:10

FSaccilotto