Closed
Description
When building with FMT_HEADER_ONLY and including fmt/core.h.
gcc version 9.2.0
$ cat fmt_test.cpp
#include <iostream>
#include <fmt/core.h>
int main()
{
std::string message = fmt::format("The answer is {}", 42);
std::cout << message << "\n";
return 0;
}
$ g++ -o fmt_test -DFMT_HEADER_ONLY -I./include fmt_test.cpp
/usr/bin/ld: /tmp/ccQQn4MB.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > fmt::v6::format<char [17], int, char>(char const (&) [17], int&&)':
fmt_test.cpp:(.text._ZN3fmt2v66formatIA17_cJiEcEENSt7__cxx1112basic_stringIT1_St11char_traitsIS5_ESaIS5_EEERKT_DpOT0_[_ZN3fmt2v66formatIA17_cJiEcEENSt7__cxx1112basic_stringIT1_St11char_traitsIS5_ESaIS5_EEERKT_DpOT0_]+0x70): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > fmt::v6::internal::vformat<char>(fmt::v6::basic_string_view<char>, fmt::v6::basic_format_args<fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::internal::buffer<char> >, char> >)'
collect2: error: ld returned 1 exit status
Shouldn't this compile?
If format.h is included instead core.h, it works.
I'm trying to include only core.h, to see if I can reduce executable size.
According to benchmarks executable should be smaller than tinyformat, but it's opposite.
Metadata
Assignees
Labels
No labels
Activity