CLion 和 Platformio:找不到目标。配置问题

CLion and Platformio: target not found. Configuration issues

我遵循此 link 以便能够将 CLion 用于使用 Platformio 的 arduino 项目。我有两个问题,我会 post 在这里,因为我认为这可能是相关的。

第一期

我卡在了最后一步,上面写着

Build project (DO NOT use “Run” button, see marks on the screenshot above): Menu: Run > Build.

正如您在下一张图片中看到的,PLATFORMIO_BUILD 目标已损坏,我无法 运行 它。

Build bar

编辑配置是这样的,不知道是不是这个意思。正如您在下一张图片中看到的,错误显示:未找到目标 PLATFORMIO_BUILD。

Edit Configurations Window

我已经重复这个过程好几次了,都没有成功。 CLion 是 2017.2.3,Platformio 也是最后一个版本。

项目本身很好,因为如果我从命令行 运行 platformio run --target upload,项目编译并上传到 arduino。

第二期

我项目中的所有文件都显示黄色 header 说:

This file does not belong to any project target, code insight features might not work properly

因此,使用 CLion 的许多好处都消失了。

所有这些文件以及包含它们的文件夹都显示为灰色。我不确定我是否应该手动将它们包含在 CMAKELists 中,但据我所知,命令 platformio init --ide clion --board uno 已经解决了这个问题。

这是第一次使用 CLion,问题可能出在我不知道的一些基本配置上。谢谢!

已解决。检查 CMake 日志我收到以下错误:

Error:The C compiler "/usr/bin/cc" is not able to compile a simple test program. It fails with the following output: Change Dir: /Users/... .../default/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/make" "cmTC_ab383/fast" xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun CMake will not be able to correctly generate this project. Error:Configuration Debug The C compiler "/usr/bin/cc" is not able to compile a simple test program.

发现了同样的问题here, and here,我的解决方案是卸载命令行工具:

rm -rf /Library/Developer/CommandLineTools

然后重新安装:

xcode-select --install