Skip to content

ld error: multiple definition of std::type_info::operator==(std::type_info const&) const #86

@xparq

Description

@xparq

w64devkit 1.20.0, both 32/64 bit
(Tried to check with gcc12 in an older w64devkit which I also have here, but the project that triggers it depends on <format>.)

  • Does not happen with a stock Debian stable on WSL, using GCC 13.2 (installed from testing): g++ (Debian 13.2.0-2) 13.2.0
  • Same project builds clean with MSVC.
  • It's a single compilation unit.
  • I've been using doctest, but it didn't cause any issues earlier, and I don't think I've changed anything related.
  • I noticed this error a little while after adding std::regex stuff to the code. Not sure yet if that's related, I might test it out, if this doesn't seem familiar from elsewhere/upstream. (I've seen multiple vaguely similar reports for GCC etc., but the best matches were unanswered SO questions. [Answered one in the meantime.])
  • The project can afford -fno-rtti, so that's a viable workaround for me.
g++ -Wall --std=c++23 test.cpp
.../ld.exe: .../w64devkit/gcc13/64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/libstdc++.a(tinfo.o):tinfo.cc:
(.text$_ZNKSt9type_infoeqERKS_+0x0): multiple definition of `std::type_info::operator==(std::type_info const&) const';
...\Temp\ccOVUCq4.o:test.cpp:(.text$_ZNKSt9type_infoeqERKS_[_ZNKSt9type_infoeqERKS_]+0x0): first defined here
collect2.exe: error: ld returned 1 exit status

  (Edited for readability.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions