peng-zhihui/Dummy-Robot

稚晖君你好,我在编译dummy电机驱动的时候报错,请问下是什么原因

haoshuiwuxiang opened this issue · 6 comments

====================[ Build | Ctrl-Step-STM32-fw.elf | Debug ]==================
"C:\Program Files\JetBrains\CLion 2021.2.2\bin\cmake\win\bin\cmake.exe" --build D:\STM32\Dummy-Robot-main\2.Firmware\Ctrl-Step-Driver-STM32F1-fw\cmake-build-debug --target Ctrl-Step-STM32-fw.elf -- -j 19
[ 1%] Linking CXX executable Ctrl-Step-STM32-fw.elf
d:/stm32/clion_stm32_windows/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/Ctrl/Driver/tb67h450_base.cpp.obj:(.rodata._ZTV12TB67H450Base+0x1c): undefined reference to TB67H450Base::InitGpio()' d:/stm32/clion_stm32_windows/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/Ctrl/Driver/tb67h450_base.cpp.obj:(.rodata._ZTV12TB67H450Base+0x20): undefined reference to TB67H450Base::InitPwm()'
d:/stm32/clion_stm32_windows/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/Ctrl/Driver/tb67h450_base.cpp.obj:(.rodata._ZTV12TB67H450Base+0x24): undefined reference to TB67H450Base::DacOutputVoltage(unsigned short, unsigned short)' d:/stm32/clion_stm32_windows/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/Ctrl/Driver/tb67h450_base.cpp.obj:(.rodata._ZTV12TB67H450Base+0x28): undefined reference to TB67H450Base::SetInputA(bool, bool)'
d:/stm32/clion_stm32_windows/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/Ctrl/Driver/tb67h450_base.cpp.obj:(.rodata._ZTV12TB67H450Base+0x2c): undefined reference to TB67H450Base::SetInputB(bool, bool)' d:/stm32/clion_stm32_windows/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/Ctrl/Sensor/Encoder/mt6816_base.cpp.obj:(.rodata._ZTV10MT6816Base+0x14): undefined reference to MT6816Base::SpiInit()'
d:/stm32/clion_stm32_windows/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/Ctrl/Sensor/Encoder/mt6816_base.cpp.obj:(.rodata._ZTV10MT6816Base+0x18): undefined reference to `MT6816Base::SpiTransmitAndRead16Bits(unsigned short)'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\Ctrl-Step-STM32-fw.elf.dir\build.make:827: Ctrl-Step-STM32-fw.elf] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:82: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:89: CMakeFiles/Ctrl-Step-STM32-fw.elf.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:123: Ctrl-Step-STM32-fw.elf] Error 2

我也遇到了相同的问题,困扰我一周了,看网上说是没有include相应的头文件,我试了一下,但错误更多了,不知道老哥解决了吗?

老哥,问题解决了,有小伙伴询问过智晖君,解决办法是:更换gcc-arm-none-eabi版本为9.2.1

ZK-y53 commented

试试编译release模式

老哥,问题解决了,有小伙伴询问过智晖君,解决办法是:更换gcc-arm-none-eabi版本为9.2.1

或者用新版gcc-arm,手动加入那几个虚函数的空实现virtual xxx() {}。不过新版gcc-arm编译出来的文件大了,就没有足够空间给校验数据了。所以还是推荐换gcc-arm到9.2.1