cannot configure a CMake target with CLion (Nothing to run on)?

发布时间 2023-03-28 14:52:07作者: Kael'thas

ERROR:打开之前的stm32项目 Clion 无法识别 CMakeLists.txt,编译按钮变成灰色,点击run按钮会产生 cannot build xxx.elf 或者 Nothing to run on,在run配置target和executable不到elf文件。

 

解决方法:抽风了大概,打开右上角run configurations配置删除CMake Application,然后新建一个c/c++ File来跑main.c,结果自然是跑不通的。再打开一次删除c/c++ File编译,重建CMake Application,保存退出。

 

在main.c页面报错说找不到 CMakeLists.txt,选手动加载项目根目录下的 CMakeLists.txt