0

我将以下代码放入两个 .cpp 中,并在 Mac 上使用 clang 将其交叉编译为 ARM64 架构。使用了 C++14。

template <int>
constexpr bool  Variable = true;

template <>
constexpr bool  Variable<1> = false;

我收到以下链接器错误。

duplicate symbol 'Variable<1>' in:
    Main.cpp.o
    Other.cpp.o
ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

与其他编译器一起工作正常,即使在针对 x86-64 时使用 clang。

这是clang中的错误吗?

4

0 回答 0