Using the latest bit from the master branch, my small console project broke with Microsoft C++ compiler Version 19.21.27702.2 for x64.
/JMC /permissive- /Yu"pch.h" /GS /Zc:rvalueCast /W4 /Zc:wchar_t /I"......\fmt\include" /ZI /Gm- /Od /sdl /Fd"x64\Debug\vc142.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MTd /std:c++17 /FC /Fa"x64\Debug\" /EHsc /nologo /Fo"x64\Debug\" /Fp"x64\Debug\......pch" /diagnostics:caret
Removing the template parameter in the definition seems to fix all of them but I don't know enough about the library and its testing to confirm this does not have an unwanted side-effect.
For example:
template <>
const uint32_t basic_data<>::ZERO_OR_POWERS_OF_10_32[] = {0,
FMT_POWERS_OF_10(1)};
error LNK2001: unresolved external symbol "public: static unsigned int const * const fmt::v5::internal::basic_data<void>::ZERO_OR_POWERS_OF_10_32" (?ZERO_OR_POWERS_OF_10_32@?$basic_data@X@internal@v5@fmt@@2QBIB)
error LNK2001: unresolved external symbol "public: static unsigned __int64 const * const fmt::v5::internal::basic_data<void>::ZERO_OR_POWERS_OF_10_64" (?ZERO_OR_POWERS_OF_10_64@?$basic_data@X@internal@v5@fmt@@2QB_KB)
error LNK2001: unresolved external symbol "public: static unsigned __int64 const * const fmt::v5::internal::basic_data<void>::ZERO_OR_POWERS_OF_10_64" (?ZERO_OR_POWERS_OF_10_64@?$basic_data@X@internal@v5@fmt@@2QB_KB)
error LNK2001: unresolved external symbol "public: static char const * const fmt::v5::internal::basic_data<void>::DIGITS" (?DIGITS@?$basic_data@X@internal@v5@fmt@@2QBDB)
error LNK2001: unresolved external symbol "public: static char const * const fmt::v5::internal::basic_data<void>::DIGITS" (?DIGITS@?$basic_data@X@internal@v5@fmt@@2QBDB)
error LNK2001: unresolved external symbol "public: static char const * const fmt::v5::internal::basic_data<void>::HEX_DIGITS" (?HEX_DIGITS@?$basic_data@X@internal@v5@fmt@@2QBDB)
error LNK2001: unresolved external symbol "public: static char const * const fmt::v5::internal::basic_data<void>::HEX_DIGITS" (?HEX_DIGITS@?$basic_data@X@internal@v5@fmt@@2QBDB)
error LNK2001: unresolved external symbol "public: static unsigned __int64 const * const fmt::v5::internal::basic_data<void>::POWERS_OF_10_64" (?POWERS_OF_10_64@?$basic_data@X@internal@v5@fmt@@2QB_KB)
error LNK2001: unresolved external symbol "public: static unsigned __int64 const * const fmt::v5::internal::basic_data<void>::POW10_SIGNIFICANDS" (?POW10_SIGNIFICANDS@?$basic_data@X@internal@v5@fmt@@2QB_KB)
error LNK2001: unresolved external symbol "public: static short const * const fmt::v5::internal::basic_data<void>::POW10_EXPONENTS" (?POW10_EXPONENTS@?$basic_data@X@internal@v5@fmt@@2QBFB)
As commented in #1080, format_data is defined here: https://github.com/fmtlib/fmt/blob/5b7bbf88537f704005e3e71d9d4fda57e880e416/src/format.cc#L11
How do you link with {fmt}?
Thanks but I don't understand why you refer to format.cc in your comment.
Are you suggesting I should include that instead of format-inl.h?
I'm not formally linking with anything related to {fmt}.
Here is what I do:
pch.h:
#ifndef PCH_H
#define PCH_H
#define NOMINMAX
#include <Windows.h>
#include <HighLevelMonitorConfigurationAPI.h>
#pragma comment(lib,"Dxva2.lib")
#include <lowlevelmonitorconfigurationapi.h>
#include <cassert>
#include <memory>
#include <string>
#include <string_view>
#include <iostream>
#include <vector>
#include "gsl/gsl_util"
#include "fmt/format.h"
#endif //PCH_H
pch.cpp:
#include "pch.h"
#include "fmt/format-inl.h"
You shouldn鈥檛 include <fmt/format-inl.h> directly. To use fmt as a header-only library, FMT_HEADER_ONLY needs to be defined (preferably on the command line, /DFMT_HEADER_ONLY=1 for MSVC) or if you use CMake, add fmt::fmt-header-only to your target_link_libraries.
See also https://fmt.dev/latest/api.html which documents public headers.
Most helpful comment
See also https://fmt.dev/latest/api.html which documents public headers.