# Problems with libfmt v8 in root macros and root prompt

Dear all,

after libfmt was updated to v8, I get the following error in the root prompt, but also when trying to use it in root macros:

``````root [0] #include<fmt/format.h>
root [1] fmt::print("hi")
IncrementalExecutor::executeFunction: symbol '_ZN3fmt2v86vprintENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_20basic_format_contextINS0_8appenderEcEEEE' unresolved while linking [cling interface function]!
You are probably missing the definition of fmt::v8::vprint(fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)
Maybe you need to load the corresponding shared library?
``````

I guess either in libfmt some implementations were moved from the header to the library, or root before automatically loaded \$FMT_ROOT/lib/libfmt.a

For macro compilation I managed to work around this problem by calling

``````gSystem->AddLinkedLibs("-Wl,-Bdynamic -L\$FMT_ROOT/lib -lfmt -Wl,-Bstatic");
``````

before the macro compilation. However, this is not an option for batch processing.

Does anyone have the same problem and perhaps a more solid solution?

Hi @wiechula ,
indeed I had the same issue. Another way to solve it is to define FMT_HEADER_ONLY before including fmt/format, i.e.:

``````root [0] #define FMT_HEADER_ONLY
root [1] #include <fmt/format.h>
root [2] fmt::print("hi")
``````

But I guess you’ll have the same issue in batch processing…so I hope that someone can provide a better solution.
Cheers,
Diego

Hi @dstocco ,

very nice! This indeed solves the problem and can easily also be used in macro compilation. So also batch processing will work. Thanks for providing this suggestion.

Cheers,
Jens