下载LeetCode Editor 和 C/C++ Single File Execution后
如此配置CodeFileName模板:
CMakeList.txt:
但是会报错:
CMake Error at CMakeLists.txt:8 (add_executable):
The target name "[1]-two-sum" is reserved or not valid for certain CMake
features, such as generator expressions, and may result in undefined
behavior.
解决方法:
看了很多类似错误的原因都是add_executable括号中的问题,于是我将题目模板的特殊字符去掉了,之后就没有报错了。
修改CodeFileName模板:去掉"["和"]".