Cmake error: Invalid escape sequence \\U

匿名 (未验证) 提交于 2019-12-03 00:46:02

问题:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!