fmt::printf("%.*f\n", 15, pi) makes linking fails unless linking against static lib or FMT_HEADER_ONLY defined.
Without -DFMT_HEADER_ONLY , this statement
fmt::printf("%.*f\n", 15, pi);
makes the linking fails in both clang v14 and gcc v12
[LIVE]
In clang-cl v14, lld-link fails as below.
lld-link: error: void __cdecl fmt::v9::vprint(class fmt::v9::basic_string_view<char>, class fmt::v9::basic_format_args<class fmt::v9::basic_format_context<class fmt::v9::appender, char>>) was replaced
clang-cl: error: linker command failed with exit code 1 (use -v to see invocation)
In clang-cl v14, removing -DFMT_SHARED solves this.
It looks like dynamic precision fmt::printf causes problems on dynamic lib linking.
Closing per email comment:
Now the current master 192859c doesn't have this issue. However the issue still shows on compiler explorer as link above. You may close this. Thank you.
I'm sorry that I didn't clearify the deleted comment. I've mistaken that with static linking.
The issue is still standing.
Both clang 14 and gcc 12 work in https://compiler-explorer.com/z/MEn4MPq7a. Not sure what clang-cl error means but it might be due to incompatible build settings. Closing as this doesn't look actionable from our side but if you have any workarounds, a PR would be welcome.