简体   繁体   中英

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 !

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 ie 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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM