dimanche 2 août 2015

linker issue with atomic composite struct c++

I'm failing to compile the following program under the environment Cygwin and using gcc 4.9.3

#include <atomic>

struct composite_struct
{
  int anInt;
  int* aPointer;
};

int main()
{
  composite_struct non_atomic_struct;
  non_atomic_struct.anInt = 1001;
  non_atomic_struct.aPointer = new int(1000);

  std::atomic<composite_struct> atomic_struct;
  atomic_struct.store(non_atomic_struct);
  return 0;
}

The linker sends error msg [...]"undefined reference to __atomic_store_16'" [...] relocation truncated to fit: R_X86_64_PC32 against undefined symbol__atomic_store_16'[...]

I've seen here that the problem exist on earlier version of gcc, is it still the case or gcc 4.9.3

Thanks.

Aucun commentaire:

Enregistrer un commentaire