CLion中配置LeetCode插件时Cmake报错

CLion中配置LeetCode插件时Cmake报错_第1张图片

下载LeetCode Editor 和 C/C++ Single File Execution后

如此配置CodeFileName模板:

CMakeList.txt:

CLion中配置LeetCode插件时Cmake报错_第2张图片

 但是会报错:

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模板:去掉"["和"]".

CodeFileName:

${question.frontendQuestionId}-${question.titleSlug}

CLion中配置LeetCode插件时Cmake报错_第3张图片CMakeList.txt:

CLion中配置LeetCode插件时Cmake报错_第4张图片

CLion中配置LeetCode插件时Cmake报错_第5张图片

你可能感兴趣的:(c++)