From 1e61ef923bb12118105b6449e797a0c13dca8aa8 Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Sun, 15 Feb 2026 17:39:18 +0100 Subject: [PATCH] MINGW: Fix error of use of deleted function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I tried to build the engine with MinGW and I got several errors like this one: TheForceEngine/TFE_FileSystem/filewriterAsync.cpp:29:43: error: use of deleted function ‘std::atomic::atomic(const std::atomic&)’ 29 | std::atomic s_requestCount = 0; | ^ In file included from TheForceEngine/TFE_System/types.h:6, from TheForceEngine/TFE_System/system.h:8, from TheForceEngine/TFE_FileSystem/filewriterAsync.h:2, from TheForceEngine/TFE_FileSystem/filewriterAsync.cpp:1: /usr/lib/gcc/x86_64-w64-mingw32/14/include/c++/atomic:834:7: note: declared here 834 | atomic(const atomic&) = delete; | ^~~~~~ TheForceEngine/TFE_FileSystem/filewriterAsync.cpp:29:43: note: use ‘-fdiagnostics-all-candidates’ to display considered candidates 29 | std::atomic s_requestCount = 0; | ^ /usr/lib/gcc/x86_64-w64-mingw32/14/include/c++/atomic:838:17: note: after user-defined conversion: ‘constexpr std::atomic::atomic(__integral_type)’ 838 | constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } | ^~~~~~ Attached patch fixes it. Actually, this file doesn't seem to be compiled by the Visual Studio project file, so I could not test if this change works there too. However, I have been able to build the engine also with MSVC even after this fix. --- TheForceEngine/TFE_FileSystem/filewriterAsync.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/TheForceEngine/TFE_FileSystem/filewriterAsync.cpp b/TheForceEngine/TFE_FileSystem/filewriterAsync.cpp index 9204af5af..75e0576e2 100644 --- a/TheForceEngine/TFE_FileSystem/filewriterAsync.cpp +++ b/TheForceEngine/TFE_FileSystem/filewriterAsync.cpp @@ -6,6 +6,7 @@ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN 1 +#define NOGDI 1 #include #endif @@ -26,9 +27,9 @@ namespace FileWriterAsync s32 s_freeRequests[MAX_REQUEST_COUNT]; s32 s_processRequest[MAX_REQUEST_COUNT]; - std::atomic s_requestCount = 0; - std::atomic s_freeRequestCount = 0; - std::atomic s_processRequestCount = 0; + std::atomic s_requestCount = {0}; + std::atomic s_freeRequestCount = {0}; + std::atomic s_processRequestCount = {0}; void CALLBACK fileWrittenCallback(DWORD dwErrorCode, DWORD dwBytesTransferred, LPOVERLAPPED lpOverlapped) {