From 3e3a271e521bb174f7d8fe4acddf14d203339cf7 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 10 Oct 2026 20:33:18 +0900 Subject: [PATCH] Unix: fix SystemLog include cycle in debug builds With DEBUG enabled, including StringConverter.h reaches SystemLog.h through PlatformBase.h before StringConverter is declared. The inline WriteException implementation then fails to compile. Move WriteException into Unix/SystemLog.cpp and include StringConverter.h there, keeping the logging behavior unchanged while removing the header dependency cycle. --- src/Platform/SystemLog.h | 6 +----- src/Platform/Unix/SystemLog.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Platform/SystemLog.h b/src/Platform/SystemLog.h index 4e2a9af9..0a427f84 100644 --- a/src/Platform/SystemLog.h +++ b/src/Platform/SystemLog.h @@ -14,7 +14,6 @@ #define TC_HEADER_Platform_SystemLog #include "Platform/PlatformBase.h" -#include "Platform/StringConverter.h" namespace VeraCrypt { @@ -24,10 +23,7 @@ namespace VeraCrypt static void WriteDebug (const string &debugMessage); static void WriteError (const string &errorMessage); - static void WriteException (const exception &ex) - { - WriteError (string ("exception: ") + StringConverter::ToSingle (StringConverter::ToExceptionString (ex))); - } + static void WriteException (const exception &ex); protected: SystemLog (); diff --git a/src/Platform/Unix/SystemLog.cpp b/src/Platform/Unix/SystemLog.cpp index e0af3574..eb350492 100644 --- a/src/Platform/Unix/SystemLog.cpp +++ b/src/Platform/Unix/SystemLog.cpp @@ -12,6 +12,7 @@ #include #include "Platform/SystemLog.h" +#include "Platform/StringConverter.h" namespace VeraCrypt { @@ -28,4 +29,9 @@ namespace VeraCrypt syslog (LOG_ERR, "%s", errorMessage.c_str()); closelog(); } + + void SystemLog::WriteException (const exception &ex) + { + WriteError (string ("exception: ") + StringConverter::ToSingle (StringConverter::ToExceptionString (ex))); + } }