I'm trying to statically link and compile my project on MSYS2/MingGW-w64 on Windows 10. However the internal std library spits out a ton of compile errors, and I mean a LOT, over 2k lines and 200 KB. How can I fix this?
Here's the first error block:
/mingw64/bin/g++.exe -I/home/dan9e/cartogrtist/build -I/home/dan9e/cartogrtist/src/block -I/home/dan9e/cartogrtist/src/cliParser -I/home/dan9e/cartogrtist/src/mapArt/mapArtFlat -I/home/dan9e/cartogrtist/src/mapArt/mapArtStaircase -I/home/dan9e/cartogrtist/src/palette -I/home/dan9e/cartogrtist/src/schematic -I/home/dan9e/cartogrtist/src/staircaseColumn -I/mingw64/include/GraphicsMagick -I/home/dan9e/libnbtplusplus/include -I/home/dan9e/libnbtplusplus/include/libnbtplusplus -I/home/dan9e/libnbtplusplus/include/libnbtplusplus/io -I/home/dan9e/libnbtplusplus/include/libnbtplusplus/text -I/mingw64/include/tclap -I/mingw64/include/spdlog -I/mingw64/include/fmt -g -O2 -O3 -DNDEBUG -o CMakeFiles/cartogrtist.dir/src/block/block.cpp.obj -c /home/dan9e/cartogrtist/src/block/block.cpp
In file included from C:/msys64/mingw64/include/c++/10.2.0/string:56,
from C:/msys64/mingw64/include/c++/10.2.0/bits/locale_classes.h:40,
from C:/msys64/mingw64/include/c++/10.2.0/locale:39,
from C:/msys64/mingw64/include/fmt/locale.h:11,
from C:/msys64/mingw64/include/c++/10.2.0/clocale:42,
from C:/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32/bits/c++locale.h:41,
from C:/msys64/mingw64/include/c++/10.2.0/bits/localefwd.h:40,
from C:/msys64/mingw64/include/c++/10.2.0/ios:41,
from C:/msys64/mingw64/include/c++/10.2.0/ostream:38,
from C:/msys64/mingw64/include/c++/10.2.0/iostream:39,
from C:/msys64/home/dan9e/cartogrtist/src/block/block.h:19,
from C:/msys64/home/dan9e/cartogrtist/src/block/block.cpp:17:
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc: In function 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)':
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1484:15: error: 'ctype' does not name a type; did you mean '_wctype'?
1484 | typedef ctype<_CharT> __ctype_type;
| ^~~~~
| _wctype
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1485:24: error: '__ctype_type' has not been declared
1485 | typedef typename __ctype_type::ctype_base __ctype_base;
| ^~~~~~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1501:14: error: '__ctype_type' does not name a type; did you mean '__ctype_base'?
1501 | const __ctype_type& __ct = use_facet<__ctype_type>(___in.getloc());
| ^~~~~~~~~~~~
| __ctype_base
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1507:12: error: '__ct' was not declared in this scope; did you mean '__c'?
1507 | && !__ct.is(__ctype_base::space,
| ^~~~
| __c
C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.tcc:1507:20: error: '__ctype_base' is not a class, namespace, or enumeration
1507 | && !__ct.is(__ctype_base::space,
| ^~~~~~~~~~~~
The rest can be found at: https://pastebin.com/RaiS6K75
The make command is:
dan9e@RED MINGW64 ~/cartogrtist/build
$ make -j1 1> error.log 2> error.log
CMAKE_VERBOSE_MAKEFILE
was set to ON
in CMake in order to show the commands being run.
Version info:
dan9e@RED MINGW64 ~/cartogrtist/build
$ g++ --version
g++.exe (Rev1, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dan9e@RED MINGW64 ~/cartogrtist/build
$ cmake --version
cmake version 3.17.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
dan9e@RED MINGW64 ~/cartogrtist/build
$ make --version
GNU Make 4.3
Built for x86_64-pc-msys
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
If you look at the chain of files included:
In file included from C:/msys64/mingw64/include/c++/10.2.0/string:56,
from C:/msys64/mingw64/include/c++/10.2.0/bits/locale_classes.h:40,
from C:/msys64/mingw64/include/c++/10.2.0/locale:39,
from C:/msys64/mingw64/include/fmt/locale.h:11,
from C:/msys64/mingw64/include/c++/10.2.0/clocale:42,
see there is a /fmt/locale.h
in there. That is clearly incorrect as the standard library header <clocale>
should not be including anything from outside the standard library header directory.
This problem arises because you have incorrectly specified /mingw64/include/fmt
as an include path, so the file fmt/locale.h
is now found by a #include "locale.h"
when it should not be.
Your build command should not have any -I
switches with argument starting /mingw64
. The /mingw64/include
directory is enabled on the search path by default .
To use the header whose location is /mingw64/include/fmt/format.h
, you write #include <fmt/format.h>
in your program , and it is found because /mingw64/include
is searched for that name.