1

我制作了类似教程的项目https://blog.jetbrains.com/clion/2019/02/clion-2019-1-eap-clion-for-embedded-development-part-iii/?gclid=CjwKCAjwhOD0BRAQEiwAK7JHmKUzvoJnORtCn3YxpsSb00Ep_dE0gNQOytiXVgFj6EXOwjyCAIH&EgXTBosrcQQAwjyCAIH&EgXTBosrcQQAawjyCAIH

我从https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads获得 arm 工具链

通过 .bashrc 将 bin 文件夹添加到 PATH。控制台命令运行良好:

$ arm-none-eabi-gcc
arm-none-eabi-gcc: fatal error: no input files

使用 STM32CubeMX 在 Clion 中制作项目后 cmake 未配置:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: arm-none-eabi-gcc
CMake Error at CMakeLists.txt:34 (PROJECT):
  The CMAKE_C_COMPILER:

    arm-none-eabi-gcc

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

但是 bin 文件夹已经在 PATH 中!!!

如果通过 pacman 安装 toolchail 或将 bin 文件夹的所有内容复制到 /usr/bin/,Clion 会查看编译器,但找不到其他文件,如 nano.specs、nosys.specs、stdint.h 和其他包含。

我不知道如何将 Clion 和 CubeMX 指向工具链的正确路径。

4

1 回答 1

0

看来您的 cmake 找不到 C/C++ 编译器。在 CLion Toolchain 设置中,您可以指定编译器的路径(在您的情况下为 arm-none-eabi-gcc 和 arm-none-eabi-g++),或者只是通过CMAKE_C_COMPILERCMAKE_CXX_COMPILER定义将它们传递给 CMkae。

于 2020-04-17T16:59:59.803 回答