Skip to content

undefined reference to `__cxa_guard_acquire' - was: Template issues?! #1498

Closed
@tuxedo0801

Description

@tuxedo0801

Hi there,

I'm not a real C++ expert, but trying to port a arduino library to esp8266/Arduino... (working with Arduino IDE 1.6.6 on Debian Linux 8 arm64 and 2.1.0-rc2 via boardmanager)

I thought doing a #ifdef here and there would do it. But now I'm struggling with this issue:

When compiling, I get the following error:

...../KnxDevice.cpp:236:106: error: duplicate explicit instantiation of 'e_KnxDeviceStatus KnxDevice::read(byte, T&) [with T = unsigned char; byte = unsigned char]' [-fpermissive]
 template e_KnxDeviceStatus KnxDevice::read <unsigned char>(byte objectIndex, unsigned char& returnedValue);
                                                                                                          ^
...../KnxDevice.cpp:283:98: error: duplicate explicit instantiation of 'e_KnxDeviceStatus KnxDevice::write(byte, T) [with T = unsigned char; byte = unsigned char]' [-fpermissive]
 template e_KnxDeviceStatus KnxDevice::write <unsigned char>(byte objectIndex, unsigned char value);

And that's the corresponding KnxDevice.cpp (line 235-243):

template e_KnxDeviceStatus KnxDevice::read <boolean>(byte objectIndex, boolean& returnedValue);
template e_KnxDeviceStatus KnxDevice::read <unsigned char>(byte objectIndex, unsigned char& returnedValue);
template e_KnxDeviceStatus KnxDevice::read <char>(byte objectIndex, char& returnedValue);
template e_KnxDeviceStatus KnxDevice::read <unsigned int>(byte objectIndex, unsigned int& returnedValue);
template e_KnxDeviceStatus KnxDevice::read <int>(byte objectIndex, int& returnedValue);
template e_KnxDeviceStatus KnxDevice::read <unsigned long>(byte objectIndex, unsigned long& returnedValue);
template e_KnxDeviceStatus KnxDevice::read <long>(byte objectIndex, long& returnedValue);
template e_KnxDeviceStatus KnxDevice::read <float>(byte objectIndex, float& returnedValue);
template e_KnxDeviceStatus KnxDevice::read <double>(byte objectIndex, double& returnedValue);

and the related snippet from the header file:

    template <typename T>  e_KnxDeviceStatus read(byte objectIndex, T& returnedValue);

Of course it's a kind of duplicate, but with a different type flavor.
With arduino board the code compiles fine.

Any hints on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions