現在WindowsのMinGw/gccを使用して、プログラミングの学習を行っている者です。 コンパイルオプションでstd=c++11を指定すると`<`bits/stdc++.h`>`をインクルードした際にエラーが発生します。 この問題はstd=c++11オプションと`<`bits/stdc++.h`>`を同時に使用した場合のみ発生し、どちらか一方のみを使用した際には問題なくコンパイルが通ります。 当方エラーメッセージも読めない初心者ですが、どうやらstdc++.h内でインクルードしている`<`cwchar`>`内で大量のエラーが起きているのだと解釈をしています。 しかし、これらのエラーは`<`cwchar`>`単体でインクルードした際には発生しません。 stdc++.hを使うのは好ましくないという意見もございましょうが、 その点に関してはやむを得ぬ事情があるということで納得していただきたく思います。 下にエラーの出るコード、出ないコード、 そしてエラーメッセージの全文とgccのバージョン情報を載せておきます。 どうか皆様お力添えの程、宜しくお願い致します。 **追記**:コンパイルオプションは次の通り指定しています。 > D:\Study\C++>g++ test.cpp -std=c++11 //これはコンパイルが通る #include <iostream> #include <cwchar> using namespace std; int main(){ cout << "test" << endl; } --- //これは通らない #include <bits/stdc++.h> using namespace std; int main(){ cout << "test" << endl; } //エラーメッセージ In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\postypes.h:40:0, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:40, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\istream:38, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\sstream:38, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\complex:45, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ccomplex:38, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\mingw32\bits\stdc++.h:52, from test.cpp:1: c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:177:11: error: '::wcscat' has not been declared using ::wcscat; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:178:11: error: '::wcscmp' has not been declared using ::wcscmp; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:179:11: error: '::wcscoll' has not been declared using ::wcscoll; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:180:11: error: '::wcscpy' has not been declared using ::wcscpy; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:181:11: error: '::wcscspn' has not been declared using ::wcscspn; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:183:11: error: '::wcslen' has not been declared using ::wcslen; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:184:11: error: '::wcsncat' has not been declared using ::wcsncat; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:185:11: error: '::wcsncmp' has not been declared using ::wcsncmp; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:186:11: error: '::wcsncpy' has not been declared using ::wcsncpy; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:188:11: error: '::wcsspn' has not been declared using ::wcsspn; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:193:11: error: '::wcstok' has not been declared using ::wcstok; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:196:11: error: '::wcsxfrm' has not been declared using ::wcsxfrm; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:204:11: error: '::wcschr' has not been declared using ::wcschr; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:205:11: error: '::wcspbrk' has not been declared using ::wcspbrk; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:206:11: error: '::wcsrchr' has not been declared using ::wcsrchr; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:207:11: error: '::wcsstr' has not been declared using ::wcsstr; ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcschr(wchar_t*, wchar_t)': c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:213:55: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive] { return wcschr(const_cast<const wchar_t*>(__p), __c); } ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:212:3: note: initializing argument 1 of 'wchar_t* std::wcschr(wchar_t*, wchar_t)' wcschr(wchar_t* __p, wchar_t __c) ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)': c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:217:58: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive] { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:216:3: note: initializing argument 1 of 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)' wcspbrk(wchar_t* __s1, const wchar_t* __s2) ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)': c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:221:56: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive] { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:220:3: note: initializing argument 1 of 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)' wcsrchr(wchar_t* __p, wchar_t __c) ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)': c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:225:57: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive] { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } ^ c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:224:3: note: initializing argument 1 of 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)' wcsstr(wchar_t* __s1, const wchar_t* __s2) ^ In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:40:0, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\istream:38, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\sstream:38, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\complex:45, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ccomplex:38, from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\mingw32\bits\stdc++.h:52, from test.cpp:1: c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h: In static member function 'static std::size_t std::char_traits<wchar_t>::length(const char_type*)': c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h:358:26: error: 'wcslen' was not declared in this scope { return wcslen(__s); } ^ //GCCのバージョン gcc (GCC) 5.3.0 Copyright (C) 2015 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.