在Linux测试使用EIDE的从远程仓库创建新项目的功能。发现其中对于C++ SDK的模板编译时会报错,显示链接问题。

/home/wikechao/code/stm32-cpp/sdk/include/gpio/f4/features/DigitalOutputFeature.h:82:(.text._ZN9stm32plus20DigitalOutputFeatureIL17GPIOSpeed_TypeDef2ELNS_4Gpio14GpioOutputTypeE1ELNS2_18GpioPullUpDownTypeE0EJLh1ELh3ELh5EEE10initialiseEtS1_S3_S4_[_ZN9stm32plus20DigitalOutputFeatureIL17GPIOSpeed_TypeDef2ELNS_4Gpio14GpioOutputTypeE1ELNS2_18GpioPullUpDownTypeE0EJLh1ELh3ELh5EEE10initialiseEtS1_S3_S4_]+0x34): undefined reference to `GPIO_Init'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: ./build/Debug/.obj/examples/blink/blink.o: in function `stm32plus::GpioPort<1073872896ul, stm32plus::DigitalOutputFeature<(GPIOSpeed_TypeDef)2, (stm32plus::Gpio::GpioOutputType)1, (stm32plus::Gpio::GpioPullUpDownType)0, (unsigned char)1, (unsigned char)3, (unsigned char)5> >::initClock()':
/home/wikechao/code/stm32-cpp/sdk/include/gpio/f4/GpioPort.h:63:(.text._ZN9stm32plus8GpioPortILm1073872896EJNS_20DigitalOutputFeatureIL17GPIOSpeed_TypeDef2ELNS_4Gpio14GpioOutputTypeE1ELNS3_18GpioPullUpDownTypeE0EJLh1ELh3ELh5EEEEEEC2Ev[_ZN9stm32plus8GpioPortILm1073872896EJNS_20DigitalOutputFeatureIL17GPIOSpeed_TypeDef2ELNS_4Gpio14GpioOutputTypeE1ELNS3_18GpioPullUpDownTypeE0EJLh1ELh3ELh5EEEEEEC5Ev]+0x8): undefined reference to `RCC_AHB1PeriphClockCmd'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: ./build/Debug/.obj/examples/blink/blink.o: in function `stm32plus::Gpio::set() const':
/home/wikechao/code/stm32-cpp/sdk/include/gpio/f4/Gpio.h:175:(.text._ZN5Blink3runEv[_ZN5Blink3runEv]+0x16): undefined reference to `GPIO_WriteBit'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: ./build/Debug/.obj/examples/blink/blink.o: in function `stm32plus::Gpio::reset() const':
/home/wikechao/code/stm32-cpp/sdk/include/gpio/f4/Gpio.h:193:(.text._ZN5Blink3runEv[_ZN5Blink3runEv]+0x2c): undefined reference to `GPIO_WriteBit'
/usr/lib/gcc/arm-none-eabi/13.2.1/../../../arm-none-eabi/bin/ld: ./build/Debug/.obj/examples/blink/blink.o: in function `main':
/home/wikechao/code/stm32-cpp/./examples/blink/blink.cpp:75:(.text.main+0x4): undefined reference to `stm32plus::MillisecondTimer::initialise()'
Memory region         Used Size  Region Size  %age Used
           FLASH:        5948 B         1 MB      0.57%
             RAM:        1052 B       192 KB      0.54%
       MEMORY_B1:           0 B          0 B
collect2: error: ld returned 1 exit status

  • admin replied to this.
  • Eplankton

    需要链接一个静态库,这个模板下面有个 README,读一下

    原因是:这个模板的 eide.json 格式太旧了,不兼容现在的插件,所以少了编译参数,后面会更新下模板

    Eplankton

    需要链接一个静态库,这个模板下面有个 README,读一下

    原因是:这个模板的 eide.json 格式太旧了,不兼容现在的插件,所以少了编译参数,后面会更新下模板

      admin 好的,谢谢。之前已经试过加 -lxxx 这样去链接了,感觉没效果(xxx是那三个静态库的名字)。

        Eplankton 现在问题解决了,首先应该把-l那边的“lib”前缀删掉,其次应该打开-hard浮点

        Write a Reply...