I am using a simple well tested and used code from Github, but when I compile it I get "Undefined reference" to all the variables and declarations in my #include files. I have downloaded all the zip files and libraries and I am not getting a message about a missing #include
Its got to be something simple but I am pulling my hair out
Arduino IDE 2.3.2
ESP32 Dev
Windows 11
Thanks
Bill
PaulRB
February 20, 2024, 7:04pm
2
Please post the complete set of error messages (inside code tags).
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal._Z5setupv+0x5c): undefined reference to AS5600::isConnected()' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal._Z5setupv+0x60): undefined reference to
AS5600::readAngle()'
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal._Z5setupv+0x64): undefined reference to PID::SetMode(int)' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal._Z5setupv+0x68): undefined reference to
PID::SetOutputLimits(double, double)'
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal._Z5setupv+0x6c): undefined reference to PID::SetSampleTime(int)' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal._Z4loopv+0x38): undefined reference to
PID::SetTunings(double, double, double)'
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal._Z4loopv+0x3c): undefined reference to PID::Compute()' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal.startup._GLOBAL__sub_I_as5600+0x0): undefined reference to
AS5600::AS5600(TwoWire*)'
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o:(.literal.startup._GLOBAL__sub_I_as5600+0x4): undefined reference to PID::PID(double*, double*, double*, double, double, double, int)' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o: in function
setup()':
C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:55: undefined reference to AS5600::isConnected()' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:60: undefined reference to
AS5600::readAngle()'
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:85: undefined reference to PID::SetMode(int)' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:86: undefined reference to
PID::SetOutputLimits(double, double)'
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:87: undefined reference to PID::SetSampleTime(int)' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:93: undefined reference to
AS5600::readAngle()'
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o: in function loop()': C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:138: undefined reference to
PID::SetTunings(double, double, double)'
c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:138: undefined reference to PID::Compute()' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o: in function
_GLOBAL__sub_I_as5600':
C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:112: undefined reference to AS5600::AS5600(TwoWire*)' c:/users/bills/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\bills\AppData\Local\Temp\arduino\sketches\5881CA001BA8A6228AD2E29B9807AE7A\sketch\ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino.cpp.o: in function
__static_initialization_and_destruction_0':
C:\Users\bills\OneDrive\Documents\Arduino\ESP32_AS5600_DC_Motor_IBT-2_strongPID/ESP32_AS5600_DC_Motor_IBT-2_strongPID.ino:46: undefined reference to `PID::PID(double*, double*, double*, double, double, double, int)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
Delta_G
February 20, 2024, 8:27pm
4
The code you linked appears to depend on this library:
#include "AS5600.h"
Have you installed that as well? I found it quickly by searching for AS5600
in the library manager in the Arduino IDE.
Problem solved - dont leave any old ".h" files lying around
Thanks
Bill
system
Closed
August 18, 2024, 9:56pm
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.