可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
While running my OpenCL code in VC++ 10 by using CMake I am getting the following error:
CMake Error at CMakeLists.txt:6 (set): Syntax error in cmake code at C:/Users/Shreedhar/Desktop/testCL/CMakeLists.txt:6 when parsing string C:\Users\Shreedhar\Desktop\test_CL\CMakeLists Invalid escape sequence \U
回答1:
Use forward slashes /
in your paths
C:/Users/Shreedhar/Desktop/test_CL/CMakeLists
回答2:
If you are reading user input like environment variables then you'll need to do this by character replacement feature of string method.
string(REPLACE "\\" "/" outputVar ${_inputVar})
回答3:
For those who receive this error under Windows:
CMake Error at C:/Dev/cmake/share/cmake-3.8/Modules/FindBoost.cmake:903 (list):
Syntax error in cmake code at
C:/Dev/cmake/share/cmake-3.8/Modules/FindBoost.cmake:903
when parsing string
C:\Dev\mongodb\src\boost/lib${_arch_suffix}-msvc-15.0
Invalid character escape '\D'. Call Stack (most recent call first): C:/Dev/cmake/share/cmake-3.8/Modules/FindBoost.cmake:1379 (_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS)
src/bsoncxx/CMakeLists.txt:100 (find_package)
Don't set the BOOST_ROOT environment variable to a backslash-ended value.