Skip to content

Commit

Permalink
Fix "undefined reference to `fmt::v7::detail::basic_data<void>::digits'"
Browse files Browse the repository at this point in the history
  • Loading branch information
phprus committed May 31, 2021
1 parent d7ba6c3 commit ff2ca2b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@
# endif
#else
# define FMT_CLASS_API
# if defined(__GNUC__) || defined(__clang__)
# define FMT_API __attribute__((visibility("default")))
# define FMT_EXTERN_TEMPLATE_API FMT_API
# if defined(FMT_EXPORT) || defined(FMT_SHARED)
# if defined(__GNUC__) || defined(__clang__)
# define FMT_API __attribute__((visibility("default")))
# endif
# endif
#endif
#ifndef FMT_API
Expand Down
2 changes: 1 addition & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ template <typename T = void> struct basic_data {
FMT_API static constexpr const char right_padding_shifts[] = {0, 31, 0, 1, 0};
};

#ifndef FMT_HEADER_ONLY
#if defined(FMT_EXPORT) || defined(FMT_SHARED)
// Required for -flto, -fivisibility=hidden and -shared to work
extern template struct basic_data<void>;
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ template FMT_API wchar_t detail::decimal_point_impl(locale_ref);
template FMT_API void detail::buffer<wchar_t>::append(const wchar_t*,
const wchar_t*);

#ifdef FMT_EXPORT
template struct detail::basic_data<void>;
#endif

FMT_END_NAMESPACE

0 comments on commit ff2ca2b

Please sign in to comment.