Why does g++ still require -latomic

后端 未结 3 660
粉色の甜心
粉色の甜心 2020-12-18 22:00

In 29.5 Atomic types of the C++ Standard November 2014 working draft it states:

  1. There is a generic class template atomic. The type of
3条回答
  •  情书的邮戳
    2020-12-18 22:47

    Relevant reading on the GCC homepage on how and why GCC makes library calls in certain cases regarding in the first place.

    GCC and libstdc++ are only losely coupled. libatomic is the domain of the library, not the compiler -- and you can use GCC with a different library (which might provide the necessary definitions for in its main proper, or under a different name), so GCC cannot just assume -latomic.

    Also:

    GCC 4.7 does not include a library implementation as the API has not been firmly established.

    The same page claims that GCC 4.8 shall provide such a library implementation, but plans are the first victims of war. I'd guess the reason for -latomic still being necessary can be found in that vicinity.

    Besides...

    ...so far I thought that any standard conformant, single file code can be compiled via the first command.

    ...-lm has been around for quite some time if you're using math functions.

提交回复
热议问题