Linking C++ standard library works with GDC... but not DMD. (Linux)
Dicebot via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Apr 16 02:56:57 PDT 2015
On Thursday, 16 April 2015 at 08:51:15 UTC, TheGag96 wrote:
> Hi, I've got this project that requires me to link into a C++
> backend. It works just fine when using GDC:
>
> gdc *.d [client libraries]
>
> However, this command using DMD does not work:
>
> dmd -L-lstdc++ *.d [client libraries]
>
> I still get errors involving the standard library not being
> added
> like:
>
> /usr/include/c++/4.8/iostream:74: undefine reference to
> `std::ios_base::Init::Init()'
> (etc.)
>
> What do I need to do to make this work? Thanks.
Simple issue but unpleasant fix. You always must use C++ library
that matches base C++ compiler. For GDC it is GCC (which is used
by default). For DMD it is DMC (Digital Mars C compiler). For LDC
it is whatever Clang standard library is called. All those are
incompatible because rely on different compiler built-ins.
More information about the Digitalmars-d-learn
mailing list