G++ updated on MingW gets massive error messages

2020-02-01 08:47发布

问题:

I'm on Windows 10 with MinGW, and recently updated my g++, using mingw-get update and mingw-get upgrade. This error occurred, even after total MinGW reinstall. No Google searches bring up anything remotely related.

I tried compiling

#include <iostream>
int main(){}

which failed with the following:

In file included from c:\mingw\include\wchar.h:208:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_ino_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_mode_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_off_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:180:13: error: '_dev_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: '_ino_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: '_mode_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: '_dev_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: '_off_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:188:17: error: '_dev_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: '_ino_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: '_mode_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: '_dev_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: '__off64_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '_dev_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '_ino_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '_mode_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '_dev_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '__off64_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
In file included from c:\mingw\include\wchar.h:233:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\include\io.h:335:21: error: 'time_t' does not name a type
 struct _wfinddata_t __struct_finddata_t (time_t, _fsize_t);
                     ^
c:\mingw\include\io.h:335:21: error: 'time_t' does not name a type
 struct _wfinddata_t __struct_finddata_t (time_t, _fsize_t);
                     ^
c:\mingw\include\io.h:335:21: error: 'time_t' does not name a type
 struct _wfinddata_t __struct_finddata_t (time_t, _fsize_t);
                     ^
c:\mingw\include\io.h:336:24: error: 'time_t' does not name a type
 struct _wfinddatai64_t __struct_finddata_t (time_t, __int64);
                        ^
c:\mingw\include\io.h:336:24: error: 'time_t' does not name a type
 struct _wfinddatai64_t __struct_finddata_t (time_t, __int64);
                        ^
c:\mingw\include\io.h:336:24: error: 'time_t' does not name a type
 struct _wfinddatai64_t __struct_finddata_t (time_t, __int64);
                        ^
c:\mingw\include\io.h:362:24: error: '__time64_t' does not name a type
 struct __wfinddata64_t __struct_finddata_t (__time64_t, __int64);
                        ^
c:\mingw\include\io.h:362:24: error: '__time64_t' does not name a type
 struct __wfinddata64_t __struct_finddata_t (__time64_t, __int64);
                        ^
c:\mingw\include\io.h:362:24: error: '__time64_t' does not name a type
 struct __wfinddata64_t __struct_finddata_t (__time64_t, __int64);
                        ^
In file included from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:146:11: error: '::fwide' has not been declared
   using ::fwide;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:153:11: error: '::mbsinit' has not been declared
   using ::mbsinit;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:164:11: error: '::vfwscanf' has not been declared
   using ::vfwscanf;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:170:11: error: '::vswscanf' has not been declared
   using ::vswscanf;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:174:11: error: '::vwscanf' has not been declared
   using ::vwscanf;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:191:11: error: '::wcstof' has not been declared
   using ::wcstof;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:198:11: error: '::wmemcmp' has not been declared
   using ::wmemcmp;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:199:11: error: '::wmemcpy' has not been declared
   using ::wmemcpy;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:200:11: error: '::wmemmove' has not been declared
   using ::wmemmove;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:201:11: error: '::wmemset' has not been declared
   using ::wmemset;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:208:11: error: '::wmemchr' has not been declared
   using ::wmemchr;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar: In function 'wchar_t* std::wmemchr(wchar_t*, wchar_t, std::size_t)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:229:61: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
   { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
                                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:228:3: note: initializing argument 1 of 'wchar_t* std::wmemchr(wchar_t*, wchar_t, std::size_t)'
   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
   ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar: At global scope:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:248:11: error: '::wcstold' has not been declared
   using ::wcstold;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:257:11: error: '::wcstoll' has not been declared
   using ::wcstoll;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:258:11: error: '::wcstoull' has not been declared
   using ::wcstoull;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:264:22: error: '__gnu_cxx::wcstold' has not been declared
   using ::__gnu_cxx::wcstold;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:265:22: error: '__gnu_cxx::wcstoll' has not been declared
   using ::__gnu_cxx::wcstoll;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:266:22: error: '__gnu_cxx::wcstoull' has not been declared
   using ::__gnu_cxx::wcstoull;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:280:14: error: 'std::wcstof' has not been declared
   using std::wcstof;
              ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:283:14: error: 'std::vfwscanf' has not been declared
   using std::vfwscanf;
              ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:286:14: error: 'std::vswscanf' has not been declared
   using std::vswscanf;
              ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:289:14: error: 'std::vwscanf' has not been declared
   using std::vwscanf;
              ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:293:14: error: 'std::wcstold' has not been declared
   using std::wcstold;
              ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:294:14: error: 'std::wcstoll' has not been declared
   using std::wcstoll;
              ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:295:14: error: 'std::wcstoull' has not been declared
   using std::wcstoull;
              ^
In file included from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:40:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h: In static member function 'static int std::char_traits<wchar_t>::compare(const char_type*, const char_type*, std::size_t)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h:330:39: error: 'wmemcmp' was not declared in this scope
       { return wmemcmp(__s1, __s2, __n); }
                                       ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h: In static member function 'static const char_type* std::char_traits<wchar_t>::find(const char_type*, std::size_t, const char_type&)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h:338:37: error: invalid conversion from 'const char_type* {aka const wchar_t*}' to 'wchar_t*' [-fpermissive]
       { return wmemchr(__s, __a, __n); }
                                     ^
In file included from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:228:3: note: initializing argument 1 of 'wchar_t* std::wmemchr(wchar_t*, wchar_t, std::size_t)'
   wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
   ^
In file included from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:40:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h: In static member function 'static std::char_traits<wchar_t>::char_type* std::char_traits<wchar_t>::move(std::char_traits<wchar_t>::char_type*, const char_type*, std::size_t)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h:342:40: error: 'wmemmove' was not declared in this scope
       { return wmemmove(__s1, __s2, __n); }
                                        ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h: In static member function 'static std::char_traits<wchar_t>::char_type* std::char_traits<wchar_t>::copy(std::char_traits<wchar_t>::char_type*, const char_type*, std::size_t)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h:346:39: error: 'wmemcpy' was not declared in this scope
       { return wmemcpy(__s1, __s2, __n); }
                                       ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h: In static member function 'static std::char_traits<wchar_t>::char_type* std::char_traits<wchar_t>::assign(std::char_traits<wchar_t>::char_type*, std::size_t, std::char_traits<wchar_t>::char_type)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\char_traits.h:350:37: error: 'wmemset' was not declared in this scope
       { return wmemset(__s, __a, __n); }
                                     ^
In file included from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ext\string_conversions.h:41:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2849,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\string:52,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\locale_classes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\ios_base.h:41,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:42,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib: At global scope:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:201:11: error: '::lldiv_t' has not been declared
   using ::lldiv_t;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:207:11: error: '::_Exit' has not been declared
   using ::_Exit;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:211:11: error: '::llabs' has not been declared
   using ::llabs;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:213:10: error: 'lldiv_t' does not name a type
   inline lldiv_t
          ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:217:11: error: '::lldiv' has not been declared
   using ::lldiv;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:228:11: error: '::atoll' has not been declared
   using ::atoll;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:229:11: error: '::strtoll' has not been declared
   using ::strtoll;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:230:11: error: '::strtoull' has not been declared
   using ::strtoull;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:232:11: error: '::strtof' has not been declared
   using ::strtof;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:233:11: error: '::strtold' has not been declared
   using ::strtold;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:241:22: error: '__gnu_cxx::lldiv_t' has not been declared
   using ::__gnu_cxx::lldiv_t;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:243:22: error: '__gnu_cxx::_Exit' has not been declared
   using ::__gnu_cxx::_Exit;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:245:22: error: '__gnu_cxx::llabs' has not been declared
   using ::__gnu_cxx::llabs;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:246:22: error: '__gnu_cxx::div' has not been declared
   using ::__gnu_cxx::div;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:247:22: error: '__gnu_cxx::lldiv' has not been declared
   using ::__gnu_cxx::lldiv;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:249:22: error: '__gnu_cxx::atoll' has not been declared
   using ::__gnu_cxx::atoll;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:250:22: error: '__gnu_cxx::strtof' has not been declared
   using ::__gnu_cxx::strtof;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:251:22: error: '__gnu_cxx::strtoll' has not been declared
   using ::__gnu_cxx::strtoll;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:252:22: error: '__gnu_cxx::strtoull' has not been declared
   using ::__gnu_cxx::strtoull;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdlib:253:22: error: '__gnu_cxx::strtold' has not been declared
   using ::__gnu_cxx::strtold;
                      ^
In file included from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ext\string_conversions.h:43:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2849,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\string:52,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\locale_classes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\ios_base.h:41,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:42,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:175:11: error: '::snprintf' has not been declared
   using ::snprintf;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:176:11: error: '::vfscanf' has not been declared
   using ::vfscanf;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:177:11: error: '::vscanf' has not been declared
   using ::vscanf;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:178:11: error: '::vsnprintf' has not been declared
   using ::vsnprintf;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:179:11: error: '::vsscanf' has not been declared
   using ::vsscanf;
           ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:185:22: error: '__gnu_cxx::snprintf' has not been declared
   using ::__gnu_cxx::snprintf;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:186:22: error: '__gnu_cxx::vfscanf' has not been declared
   using ::__gnu_cxx::vfscanf;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:187:22: error: '__gnu_cxx::vscanf' has not been declared
   using ::__gnu_cxx::vscanf;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:188:22: error: '__gnu_cxx::vsnprintf' has not been declared
   using ::__gnu_cxx::vsnprintf;
                      ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cstdio:189:22: error: '__gnu_cxx::vsscanf' has not been declared
   using ::__gnu_cxx::vsscanf;
                      ^
In file included from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\string:52:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\locale_classes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\ios_base.h:41,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:42,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from ariprog.cpp:8:
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long long int std::stoll(const string&, std::size_t*, int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2873:31: error: 'strtoll' is not a member of 'std'
   { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(),
                               ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long long unsigned int std::stoull(const string&, std::size_t*, int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2878:31: error: 'strtoull' is not a member of 'std'
   { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(),
                               ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'float std::stof(const string&, std::size_t*)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2884:31: error: 'strtof' is not a member of 'std'
   { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); }
                               ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long double std::stold(const string&, std::size_t*)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2892:31: error: 'strtold' is not a member of 'std'
   { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); }
                               ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2899:45: error: 'vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int),
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(unsigned int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2904:45: error: 'vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2910:45: error: 'vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long),
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long unsigned int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2915:45: error: 'vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long long int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2921:45: error: 'vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long long unsigned int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2927:45: error: 'vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(float)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2936:45: error: 'vsnprintf' is not a member of 'std'
     return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(double)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2945:45: error: 'vsnprintf' is not a member of 'std'
     return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long double)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2954:45: error: 'vsnprintf' is not a member of 'std'
     return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
                                             ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long long int std::stoll(const wstring&, std::size_t*, int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2976:31: error: 'wcstoll' is not a member of 'std'
   { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(),
                               ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long long unsigned int std::stoull(const wstring&, std::size_t*, int)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2981:31: error: 'wcstoull' is not a member of 'std'
   { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(),
                               ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'float std::stof(const wstring&, std::size_t*)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2987:31: error: 'wcstof' is not a member of 'std'
   { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); }
                               ^
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long double std::stold(const wstring&, std::size_t*)':
c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2995:31: error: 'wcstold' is not a member of 'std'
   { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); }

回答1:

Thanks to @SilencePhil, I found a relevant StackOverflow answer. This question is not the same question, but has the same solution, namely to replace std=c++11 with std=gnu++11 in the call to g++.



回答2:

In Clion

  • go to CMakeList.txt, this document is next to main.cpp and
  • change -std=c++11 with -std=gnu++11


回答3:

The accepted answer is hardly a solution. Having to set the C++ standard version should not be required.

I strongly suggest you try the MinGW-w64 GCC, which does not have this problem (or at least I haven't seen it reported or experienced it myself).



回答4:

I still have not found a solution. The above did not work for me. For now, I'm using visual studios compile via command line cl /EHsc somefile.cpp. Here is a reference, https://msdn.microsoft.com/en-us/library/ms235639.aspx.



回答5:

If you are working inside CODE::BLOCKS go to Settings->Compiler. Select 'compiler settings with GNU GCC compiler' under Selected Compiler. Check the option "Have g++ follow the C++14 ISO C++ language standard [-std=c++14]" in General menu.