Skip to content

Regression? undefined reference when using different compiler #1753

Closed
@Phygon

Description

I just tried to upgrade from fmt 6.2.1 to fmt 7.0.0.
I compiled fmt with the default compiler (GCC 8.3 on Debian Buster), while the application is compiled with the most current clang++.

Reduced example code:

#include <fmt/format.h>
int main()
{
        fmt::memory_buffer mb;
        fmt::format_to(mb, "Hello {}!", 42);
}

Compiled with:
clang++ -std=c++14 -o test test.cpp -lfmt

This results in the following error:

/usr/bin/ld: /tmp/test-cbfe70.o: in function `fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::detail::buffer<char> >, char>::iterator fmt::v6::format_to<char [10], int, 500ul, char>(fmt::v6::basic_memory_buffer<char, 500ul, std::allocator<char> >&, char const (&) [10], int&&)':
test.cpp:(.text._ZN3fmt2v69format_toIA10_cJiELm500EcEENS0_20basic_format_contextISt20back_insert_iteratorINS0_6detail6bufferIT2_EEES7_E8iteratorERNS0_19basic_memory_bufferIS7_XT1_ESaIS7_EEERKT_DpOT0_[_ZN3fmt2v69format_toIA10_cJiELm500EcEENS0_20basic_format_contextISt20back_insert_iteratorINS0_6detail6bufferIT2_EEES7_E8iteratorERNS0_19basic_memory_bufferIS7_XT1_ESaIS7_EEERKT_DpOT0_]+0x88): undefined reference to `fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::detail::buffer<char> >, char>::iterator fmt::v6::detail::vformat_to<char>(fmt::v6::detail::buffer<char>&, fmt::v6::basic_string_view<char>, fmt::v6::basic_format_args<fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::detail::buffer<fmt::v6::type_identity<char>::type> >, fmt::v6::type_identity<char>::type> >)'

A similar error is printed when using clang++ for the fmt library and g++ for the test. No error if the compiler matches. With fmt 6.x, this also works without error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions