In our project, we decided to use the latest fmt version(6.2.0) in our project and use mainly the printf functionality as we had our logging where we are using printf extensively.
I built the libfmt.a on our Linux box using the CMakeLists.txt included in the fmt package.
In my process, I included the libfmt include directory and in the target_link_libraries. In the code I only used #include<fmt/printf.h>
. Now when I compile the code, the code gets compiled but at the time of linking, I get the errors: There are many more but the following is the first one and I believe if this gets resolved, rest will be resolved automatically
abc.cpp:(.text._ZN3fmt2V68internal8groupingIcEESsNS1_10locale_refE[_ZN3fmt2v68internal8groupingIcEESsNS1_10locale_refE]+0X20): undefined eference to `std::string fmt::v6::internal::grouping_impl(fmt::v6::internal::locale_ref)'
I did some analysis and found that this function's definition is present in format-inl.h. I tried including it in my code but still the same linking issue.
Now, when I defined the macro FMT_HEADER_ONLY in the code the linking worked.
My question is: When I am linking with the library libfmt.a, its not able to find that function. Why? I do not want to use the header-only version.
Please let me know how to get this fixed.