Arduino-Makefile:编译器无法编译用户库 cpp 文件

Arduino-Makefile: Compiler can't compile the user library cpp files

本文关键字:用户 cpp 文件 编译 编译器 Arduino-Makefile      更新时间:2023-10-16

我正在尝试将 https://github.com/sudar/Arduino-Makefile 用于 Raspberry Pi 上的 Arduino 与一些用户 cpp 库一起使用,但它无法编译并显示以下错误。

/

usr/share/arduino/hardware/tools/avr/bin/avr-gcc -mmcu=atmega2560 -wl,--gc-sections -os -flto -fuse-linker-plugin -o build-mega-atmega2560/toprint.elf build-mega-atmega2560/toprint.ino.o build-mega-atmega2560/libcore.a -lc -lm/tmp/cc1J77Gh.ltrans0.ltrans.o: 在函数main': <artificial>:(.text.startup+0x4be): undefined reference to Str2let::~Str2let((' collect2: 错误: ld 返回 1 退出状态: [/home/pi/Desktop/demo1_may9/Arduino/toprint/Arduino-Makefile/Arduino.mk:1673: build-mega-atmega2560/toprint.elf] 错误 1

我的配置文件是

ARDUINO_DIR   = /usr/share/arduino 
MONITOR_PORT  = /dev/ttyACM* 
USER_LIB_PATH = /home/pi/sketchbook/libraries
#BOARD_SUB   = mega2560 #replaced by below 
MCU = atmega2560
# Define Atmega2560 
BOARD_TAG    = mega 
BOARD_SUB    = atmega2560
AVRDUDE      = /usr/share/arduino/hardware/tools/avr

包括/home/pi/Desktop/demo1_may9/Arduino/toprint/Arduino-Makefile/Arduino.mk 有谁知道发生了什么?

相同的代码可以在Mac上运行,但不能在Pi上运行。

通过使用本文中的case[2]解决了它。只是不要定义USER_LIB_PATH并将所有文件放在与 .ino 和 Makefile 相同的位置。