I've been porting some AVR C code to C++, which means compiling some of the underlying libraries with avr-g++ for the first time. In one such library, which is based on the "ioport" library from the AVR Software Framework, I'm getting an error only when compiled as C++ code.
This is the line:
ioport_configure_port_pin(ioport_pin_to_port(pin), ioport_pin_to_mask(pin), flags);
This is the error:
undefined reference to `ioport_configure_port_pin(void*, unsigned char, unsigned int)'
...and these are the related declarations:
extern void ioport_configure_port_pin(void *port, pin_mask_t pin_mask, port_pin_flags_t flags); static inline PORT_t *ioport_pin_to_port(port_pin_t pin) { // Each port has an offset of 0x20 return (PORT_t *)((uintptr_t)&PORTA + (pin >> 3) * 0x20); } static inline pin_mask_t ioport_pin_to_mask(port_pin_t pin) { return 1U << (pin & 0x7); } typedef uint8_t pin_mask_t; typedef uint8_t pin_mask_t;
I have heard that C++ has stricter typing rules than C, which I'm guessing is at the root of this error. However, I don't know enough to figure out what is going on. Could any of you enlighten me?