You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu系统下Code::Blocks编译固件失败,求助查找avr-gcc与make路径

解决Ubuntu下Code::Blocks编译固件报错(Process terminated with status 2)的步骤

1. 安装AVR工具链和Make工具

Ubuntu下直接通过包管理器安装所需工具,打开终端执行以下命令:

sudo apt update
sudo apt install avr-libc gcc-avr make

这三个包分别对应AVR固件开发的标准库、AVR C编译器、构建工具make,安装后系统就能找到相关命令。

2. 验证工具安装状态

执行以下命令确认工具是否安装成功:

avr-gcc --version
make --version

如果能正常输出版本信息,说明安装没问题。

3. 配置Code::Blocks的编译器路径

打开Code::Blocks后按以下步骤操作:

  • 顶部菜单栏选择 Settings -> Compiler...
  • 在弹出的窗口左侧,选择 Global compiler settings -> Toolchain executables
  • 右侧的 Compiler's installation directory 填写/usr/bin(apt默认安装路径)
  • 检查下方的工具配置项,确保对应工具名称正确:
    • C compiler: avr-gcc
    • C++ compiler: avr-g++
    • Linker for dynamic libs: avr-g++
    • Linker for static libs: avr-ar
    • Make program: make
    • 若需要调试,先安装avr-gdb(执行sudo apt install avr-gdb),再将Debugger项设为avr-gdb
  • 点击 OK 保存配置

4. 重新编译项目

配置完成后回到项目,点击编译按钮重试,应该能解决因找不到编译器导致的Process terminated with status 2错误。

内容的提问来源于stack exchange,提问作者xViolet

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 07:27:04