spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

error C2079: '_' uses undefined struct 'fmt::v10::detail::type_is_unformattable_for<T,char>'

Open hoyeziyu opened this issue 1 year ago • 4 comments

I wonder why? Thank you! error C2079: '_' uses undefined struct 'fmt::v10::detail::type_is_unformattable_for<T,char>' error C2338: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt

Log.h

#include <memory>
#include "Core.h"
#include "spdlog/spdlog.h"
#include "spdlog/fmt/ostr.h"

namespace Hazel {
	class HAZEL_API Log
	{
	public:
		static void Init();

		inline static std::shared_ptr<spdlog::logger>& GetCoreLogger() { return s_CoreLogger; }
		inline static std::shared_ptr<spdlog::logger>& GetClientLogger() { return s_ClientLogger; }
	private:
		static std::shared_ptr<spdlog::logger> s_CoreLogger;
		static std::shared_ptr<spdlog::logger> s_ClientLogger;
	};
}

Log.cpp

#include "Log.h"
#include "spdlog/sinks/stdout_color_sinks.h"


namespace Hazel {
	std::shared_ptr<spdlog::logger> Log::s_CoreLogger;
	std::shared_ptr<spdlog::logger> Log::s_ClientLogger;


	void Log::Init() {
		spdlog::set_pattern("%^[%T] %n:%v%$");
		s_CoreLogger = spdlog::stdout_color_mt("Hazel");
		s_CoreLogger->set_level(spdlog::level::trace);

		s_ClientLogger = spdlog::stdout_color_mt("App");
		s_ClientLogger->set_level(spdlog::level::trace);
	}
}

image

hoyeziyu avatar Sep 17 '24 14:09 hoyeziyu

Duplicate #3147 See https://fmt.dev/10.0.0/api.html#formatting-user-defined-types

tt4g avatar Sep 17 '24 20:09 tt4g

looks like the source code for https://github.com/TheCherno/Hazel project that I have seen in several Issue (#1505, #3054) in the past. I recommend that you ask that question if it is a Hazel project issue.

tt4g avatar Sep 18 '24 03:09 tt4g

looks like the source code for https://github.com/TheCherno/Hazel project that I have seen in several Issue (#1505, #3054) in the past.看起来像我在几个问题中看到的https://github.com/TheCherno/Hazel项目的源代码( #1505 , #3054 ) 在过去。 I recommend that you ask that question if it is a Hazel project issue.如果这是 Hazel 项目问题,我建议您提出这个问题。

Yes, it is a Hazel project issue. Thank you for your reply. Let me see if it works

hoyeziyu avatar Sep 19 '24 12:09 hoyeziyu

TheCherno/Hazel#683

tt4g avatar Oct 05 '24 07:10 tt4g