Problem at make install

Started by aikk, 20 December 2022, 22:54:24



I'm having some trouble installing tgui. I already built and installed sfml, then I built successfully tgui but when I'm trying to install it via make install I'm getting this error :

Any idea ?


Apparently the error :

[ 11%] Building CXX object src/CMakeFiles/tgui.dir/Global.cpp.obj
C:\TGUI-0.9\src\Global.cpp: In function 'std::unique_ptr<unsigned char []> tgui::readFileToMemory(const tgui::String&, std::size_t&)':
C:\TGUI-0.9\src\Global.cpp:133:72: error: '_wfopen_s' was not declared in this scope
             if (_wfopen_s(&file, filename.toWideString().c_str(), L"rb") != 0)
C:\TGUI-0.9\src\Global.cpp: In function 'bool tgui::writeFile(const tgui::String&, const CharStringView&)':
C:\TGUI-0.9\src\Global.cpp:181:67: error: '_wfopen_s' was not declared in this scope
         if (_wfopen_s(&file, filename.toWideString().c_str(), L"w") != 0)
make[2]: *** [src/CMakeFiles/tgui.dir/Global.cpp.obj] Erreur 1
make[1]: *** [src/CMakeFiles/tgui.dir/all] Erreur 2

might be caused because _wfopen_s is declared in Microsoft's stdio.h but not in stdio.h that GCC is using on Windows (?)


Which MinGW version are you using?

There are many MinGW variants on Windows. TGUI only supports MinGW-w64 (which is available for both 32bit and 64bit despite what you might think from the name), and the TDM GCC one that is based on MinGW-w64. The _wfopen_s function is defined in MinGW-w64 as well. I recommend a MinGW-w64 version from with MSVCRT runtime (UCRT runtime isn't compatible with SFML).

If you use "GCC 11.2.0 + MinGW-w64 10.0.0 (MSVCRT)" from the WinLibs website then you can get a compatible SFML version from

The official MinGW version (from which MinGW-w64 branched from a long time ago), indeed doesn't provide a _wfopen_s function, so it currently isn't supported.



I was using the official MinGw version that comes with gcc 6.3.0 ...
It works now with the MinGW-w64(MSVCRT) that you sent.

Many thanks. :)