opencv: Windows 10 CMake | OPENCV_EXTRA_MODULES_PATH | Bug

  • OpenCV => Latest Github
  • Operating System / Platform => Windows 64 Bit
  • Compiler => Visual Studio 2015
CMake Error at cmake/OpenCVModule.cmake:368 (_glob_locations):
  Syntax error in cmake code at

    E:/opencv_github/opencv/cmake/OpenCVModule.cmake:368

  when parsing string

    E:\opencv_github\opencv_contrib\modules

  Invalid character escape '\o'.
Call Stack (most recent call first):
  modules/CMakeLists.txt:7 (ocv_glob_modules)

This error is only generated when i set OPENCV_EXTRA_MODULES_PATH, I have set the path to the modules folder after taking checkout of opencv_contrib.

image

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Use forward slash (‘/’) in paths, even on Windows.

I just compiled the latest OpenCV version on Windows 10 64-bit with contributor modules, it works fine. @ashuezy You maybe misunderstood what the others meant: You have to replace every \ in the path with a /.

I was able to solve this problem by inverting the address bars of the folder C:\Users\MyUser\OpenCv\opencv_contrib-4.3.0\modules to C:/Users/MyUser/OpenCv/opencv_contrib-4.3.0/modules If you are using cmake gui you can navigate to the folder using the option () in the space reserved for the value in OPENCV_EXTRA_MODULES_PATH, this brings the bars in the right format for the cmake. I hope this helps, it worked for me.

As workaround try to run cmake with ‘/’ in paths:

cmake -DOPENCV_EXTRA_MODULES_PATH=E:/opencv_github/opencv_contrib/modules ...

Any mistake in the path gives this error. My mistake was: I entered C:/Users/MyUser/OpenCv/opencv_contrib-4.3.0/ instead of C:/Users/MyUser/OpenCv/opencv_contrib-4.3.0/modules

@ashuezy / is also supported on the Windows platform.

@alalek 3.10.0