#include #include #include // This mimics what we have in TranslationUI.cpp class UILogger { public: UILogger& operator<<(const std::string& msg) { buffer_ += msg; return *this; } UILogger& operator<<(int value) { buffer_ += std::to_string(value); return *this; } UILogger& operator<<(std::ostream& (*)(std::ostream&)) { std::ofstream log("ui_debug.log", std::ios::app); log << buffer_ << std::endl; buffer_.clear(); return *this; } void flush() {} private: std::string buffer_; }; // This static object might be causing the crash! static UILogger g_test_log; int main() { MessageBoxA(NULL, "If you see this, static UILogger is NOT the problem!", "Test", MB_OK); g_test_log << "Test message" << std::endl; MessageBoxA(NULL, "Static logger works!", "Success", MB_OK); return 0; }