我正在尝试使用arduino-core和arduino-mk软件包在Raspbian上编译DumpFile example。
它通常适用于其他项目,但是当涉及到使用SD库时,我在编译时遇到错误,我不知道是不是我做错了,或者它是SD库本身的问题。< / p>
从我的changelog of the arduino-core软件包中,在我的软件包版本和最新版本之间没有修复SD库。所以升级可能没有帮助。
我正在复制运行&gt; make
的输出/usr/bin/avr-gcc -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/SD -I/home/pi/sketchbook/libraries/SD -g -Os -w -Wall -ffunction-sections -fdata-sections -fno-exceptions /usr/share/arduino/libraries/SD/File.cpp -o build-cli/libs/SD/File.o
mkdir -p build-cli/libs/SD/
/usr/bin/avr-gcc -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/SD -I/home/pi/sketchbook/libraries/SD -g -Os -w -Wall -ffunction-sections -fdata-sections -fno-exceptions /usr/share/arduino/libraries/SD/SD.cpp -o build-cli/libs/SD/SD.o
/usr/bin/avr-ar rcs build-cli/libcore.a build-cli/WInterrupts.o build-cli/wiring_analog.o build-cli/wiring.o build-cli/wiring_digital.o build-cli/wiring_pulse.o build-cli/wiring_shift.o build-cli/CDC.o build-cli/HardwareSerial.o build-cli/HID.o build-cli/IPAddress.o build-cli/main.o build-cli/new.o build-cli/Print.o build-cli/Stream.o build-cli/Tone.o build-cli/USBCore.o build-cli/WMath.o build-cli/WString.o build-cli/libs/SD/File.o build-cli/libs/SD/SD.o
/usr/bin/avr-gcc -mmcu=atmega328p -Wl,--gc-sections -Os -o build-cli/readSd.elf build-cli/readSd.o build-cli/libcore.a -lc -lm
build-cli/libcore.a(File.o): In function `File::operator bool()':
/usr/share/arduino/libraries/SD/File.cpp:146: undefined reference to `SdFile::sync()'
/usr/share/arduino/libraries/SD/File.cpp:148: undefined reference to `SdFile::write(void const*, unsigned int)'
build-cli/libcore.a(File.o): In function `File::operator bool()':
/usr/share/arduino/libraries/SD/utility/SdFat.h:214: undefined reference to `SdFile::read(void*, unsigned int)'
build-cli/libcore.a(File.o): In function `File::operator bool()':
/usr/share/arduino/libraries/SD/File.cpp:149: undefined reference to `SdFile::seekSet(unsigned long)'
build-cli/libcore.a(File.o): In function `File::operator bool()':
/usr/share/arduino/libraries/SD/utility/SdFat.h:214: undefined reference to `SdFile::close()'
build-cli/libcore.a(SD.o): In function `_GLOBAL__sub_I__Z20getNextPathComponentPcPjS_':
/usr/share/arduino/libraries/SD/utility/Sd2Card.h:155: undefined reference to `Sd2Card::init(unsigned char, unsigned char)'
build-cli/libcore.a(SD.o): In function `_GLOBAL__sub_I__Z20getNextPathComponentPcPjS_':
/usr/share/arduino/libraries/SD/utility/SdFat.h:430: undefined reference to `SdVolume::init(Sd2Card*, unsigned char)'
build-cli/libcore.a(SD.o): In function `_GLOBAL__sub_I__Z20getNextPathComponentPcPjS_':
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:43: undefined reference to `SdFile::openRoot(SdVolume*)'
build-cli/libcore.a(SD.o): In function `_GLOBAL__sub_I__Z20getNextPathComponentPcPjS_':
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `SdVolume::init(Sd2Card*, unsigned char)'
/usr/share/arduino/libraries/SD/utility/SdFat.h:430: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:430: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `SdFile::close()'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `SdFile::open(SdFile*, char const*, unsigned char)'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `SdFile::close()'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `SdFile::open(SdFile*, char const*, unsigned char)'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `SdFile::open(SdFile*, char const*, unsigned char)'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `SdFile::close()'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `SdFile::seekSet(unsigned long)'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `vtable for SdFile'
/usr/share/arduino/libraries/SD/utility/SdFat.h:138: undefined reference to `vtable for SdFile'
collect2: error: ld returned 1 exit status
make: *** [build-cli/readSd.elf] Error 1
有人可以帮我指出这个问题吗?
由于
答案 0 :(得分:1)
请注意,SD库有一个子目录,其中包含未定义的函数。也许您需要在make中添加-I / usr / share / arduino / libraries / SD / utility