0

I try move some library from Arduino IDE to Eclipse IDE. In both cases the same compiler is used arm-none-eabi-gcc. But example in Arduino is linked succesfull, but project in Eclipse while linked have error:

RemoteXYWire.h:30: undefined reference to `vtable for CRemoteXYWire'. 

And I understand that needed to define pure virtual function. But why the same toolchain work without error in Arduino IDE? That file:

#ifndef RemoteXYWire_h
#define RemoteXYWire_h

#include "RemoteXYComm.h"

#define REMOTEXY_INIT_CRC 0xffff
#define REMOTEXY_PACKAGE_START_BYTE 0x55
#define REMOTEXY_PACKAGE_MIN_LENGTH 6


struct CRemoteXYPackage {
  uint8_t command;
  uint8_t * buffer;
  uint16_t length;
};

class CRemoteXYReceivePackageListener {
  public:
  virtual void receivePackage (CRemoteXYPackage * package) = 0;
};

class CRemoteXYWire {

  private:
  CRemoteXYReceivePackageListener * receivePackageListener;
  
  public:
  CRemoteXYWire () {
    receivePackageListener = NULL;
  }
  
  public: 
  void setReceivePackageListener (CRemoteXYReceivePackageListener * listener) {
    receivePackageListener = listener;
  }    
  
  public:
  void notifyReceivePackageListener (CRemoteXYPackage * package) {
    if (receivePackageListener) receivePackageListener->receivePackage (package);
  } 
  

  public:
  virtual void handler () {};
  virtual uint8_t running ();
  virtual void stop ();
  virtual void sendPackage (uint8_t command, uint8_t *buf, uint16_t length, uint8_t fromPgm);
  
};


#endif  //  RemoteXYWire_h

Calling linker in Arduino IDE:

arm-none-eabi-gcc -mcpu=cortex-m0 -mthumb -Os -DNDEBUG --specs=nano.specs -Wl,--defsym=LD_FLASH_OFFSET=0 -Wl,--defsym=LD_MAX_SIZE=65536 -Wl,--defsym=LD_MAX_DATA_SIZE=8192 -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--default-script=/home/kv193/.arduino15/packages/STMicroelectronics/hardware/stm32/2.3.0/variants/STM32F0xx/F030R8T/ldscript.ld -Wl,--script=/home/kv193/.arduino15/packages/STMicroelectronics/hardware/stm32/2.3.0/system/ldscript.ld -Wl,-Map,remxy-prj.ino.map -L/home/kv193/.arduino15/packages/STMicroelectronics/tools/CMSIS/5.7.0/CMSIS/DSP/Lib/GCC/ -larm_cortexM0l_math -o remxy-prj.ino.elf @object.list -lc -Wl,--end-group -lm -lgcc -lstdc++

Call linker from Eclipse:

arm-none-eabi-g++ --specs=nano.specs  --specs=nosys.specs -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -T"/home/kv193/KV/sRobot/verter-f1/LinkerScript.ld" -Wl,-Map=output.map -Wl,--gc-sections -fno-exceptions -fno-rtti -o "verter-f1.elf" @"objects.list"   -lm

Why so significant difference results in that IDE's?

kv193
  • 1
  • 1
  • Use the arm-none-eabi-g++ as the linker for the c++ code – KIIV Nov 07 '22 at 11:45
  • Of course I used arm-none-eabi-g++ in Eclipse (commands added to question). Note that Arduino use arm-none-eabi-gcc. I try both variant in Eclipse with the same error. – kv193 Nov 07 '22 at 20:54

0 Answers0