[Solved] spdlog reports an error After updating Ubuntu 22.04

After updating Ubuntu 22, spdlog and FMT report errors, mainly due to some unclear problems in the FMT library

Solution:

1. Copy the header file under include/FMT of FMT Library

to this directory

2. In spdlog/include/spdlog/fmt/bundled/core.h add a macro definition of FMT_NOEXCEPT near line 154, which is the following code

// Define FMT_USE_NOEXCEPT to make fmt use noexcept (C++11 feature).
#ifndef FMT_USE_NOEXCEPT
#  define FMT_USE_NOEXCEPT 0
#endif

#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
    FMT_GCC_VERSION >= 408 || FMT_MSC_VER >= 1900
#  define FMT_DETECTED_NOEXCEPT noexcept
#  define FMT_HAS_CXX11_NOEXCEPT 1
#else
#  define FMT_DETECTED_NOEXCEPT throw()
#  define FMT_HAS_CXX11_NOEXCEPT 0
#endif

#ifndef FMT_NOEXCEPT
#  if FMT_EXCEPTIONS || FMT_HAS_CXX11_NOEXCEPT
#    define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT
#  else
#    define FMT_NOEXCEPT
#  endif
#endif

3. Recompile and install spdlog Library

cmake -S spdlog -B /tmp/build/
cd /tmp/build && make
sudo make install

Read More: