PlatformIO Community

Error compiling project

Hi everyone,
I have a problem, I cannot compile anymore my project. Everytime I try, i get always:

>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\new:55:3: error: expected class-name before '{' token
>   {
>   ^
>In file included from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\string:53,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/error.ipp:19,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/src.hpp:22,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\src\asio.cpp:11:
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.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:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\basic_string.tcc:1473:15: error: 'ctype' does not name a type; did you mean 'crypt'?
>       typedef ctype<_CharT>    __ctype_type;
>               ^~~~~
>               crypt
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\basic_string.tcc:1474:24: error: '__ctype_type' has not been declared
>       typedef typename __ctype_type::ctype_base         __ctype_base;
>                        ^~~~~~~~~~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\basic_string.tcc:1490:14: error: '__ctype_type' does not name a type; did you mean '__ctype_base'?
>        const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
>              ^~~~~~~~~~~~
>              __ctype_base
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\basic_string.tcc:1496:12: error: '__ct' was not declared in this scope
>        && !__ct.is(__ctype_base::space,
>            ^~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\basic_string.tcc:1496:12: note: suggested alternative: '__c'
>        && !__ct.is(__ctype_base::space,
>            ^~~~
>            __c
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\basic_string.tcc:1496:20: error: '__ctype_base' is not a class, namespace, or enumeration
>        && !__ct.is(__ctype_base::space,
>                    ^~~~~~~~~~~~
>In file included from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\system_error:41,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/error_code.hpp:25,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/error.hpp:19,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/error.ipp:20,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/src.hpp:22,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\src\asio.cpp:11:
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\stdexcept: At global scope:
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\stdexcept:114:3: error: expected class-name before '{' token
>   {
>   ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\stdexcept:198:3: error: expected class-name before '{' token
>   {
>   ^
>In file included from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/detail/global.hpp:25,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/executor.hpp:21,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/executor.hpp:336,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/executor.ipp:19,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/src.hpp:25,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\src\asio.cpp:11:
>C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/detail/posix_global.hpp: In function 'T& asio::detail::posix_global()':
>C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/detail/posix_global.hpp:68:10: error: 'terminate' is not a member of 'std'
>     std::terminate();
>          ^~~~~~~~~
>Compiling .pio\build\esp32dev\bt\host\bluedroid\bta\ar\bta_ar.o
>Compiling .pio\build\esp32dev\bt\host\bluedroid\bta\av\bta_av_aact.o
>Compiling .pio\build\esp32dev\bt\host\bluedroid\bta\av\bta_av_act.o
>In file included from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\ios_base.h:41,
>                 from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\ios:42,
>                 from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\istream:38,
>                 from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\sstream:38,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/ip/detail/impl/endpoint.ipp:21,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/src.hpp:79,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\src\asio.cpp:11:
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h: At global scope:
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:333:37: error: '_GLIBCXX_NUM_CATEGORIES' was not declared in this scope
>     enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES };
>                                     ^~~~~~~~~~~~~~~~~~~~~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:380:12: error: '__c_locale' does not name a type; did you mean 'locale'?
>     static __c_locale                   _S_c_locale;
>            ^~~~~~~~~~
>            locale
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:411:24: error: '__c_locale' has not been declared
>     _S_create_c_locale(__c_locale& __cloc, const char* __s,
>                        ^~~~~~~~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:412:10: error: '__c_locale' has not been declared
>          __c_locale __old = 0);
>          ^~~~~~~~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:414:12: error: '__c_locale' does not name a type; did you mean 'locale'?
>     static __c_locale
>            ^~~~~~~~~~
>            locale
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:418:25: error: '__c_locale' has not been declared
>     _S_destroy_c_locale(__c_locale& __cloc);
>                         ^~~~~~~~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:420:12: error: '__c_locale' does not name a type; did you mean 'locale'?
>     static __c_locale
>            ^~~~~~~~~~
>            locale
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:425:12: error: '__c_locale' does not name a type; did you mean 'locale'?
>     static __c_locale
>            ^~~~~~~~~~
>            locale
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:642:44: error: qualified name does not name a class before ':' token
>     class _GLIBCXX_NAMESPACE_CXX11 collate : public locale::facet
>                                            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:642:44: error: expected '{' before ':' token
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:793:23: error: expected initializer before '<' token
>     locale::id collate<_CharT>::id;
>                       ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:798:12: error: expected initializer before '<' token
>     collate<char>::_M_compare(const char*, const char*) const throw();
>            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:802:12: error: expected initializer before '<' token
>     collate<char>::_M_transform(char*, const char*, size_t) const throw();
>            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:807:12: error: expected initializer before '<' token
>     collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const throw();
>            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:811:12: error: expected initializer before '<' token
>     collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const throw();
>            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:816:51: error: qualified name does not name a class before ':' token
>     class _GLIBCXX_NAMESPACE_CXX11 collate_byname : public collate<_CharT>
>                                                   ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:816:51: error: expected '{' before ':' token
>In file included from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.h:851,
>                 from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\ios_base.h:41,
>                 from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\ios:42,
>                 from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\istream:38,
>                 from c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\sstream:38,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/ip/detail/impl/endpoint.ipp:21,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\include/asio/impl/src.hpp:79,
>                 from C:\.platformio\packages\framework-espidf@3.40201.210513\components\asio\asio\asio\src\asio.cpp:11:
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc: In member function 'bool std::locale::operator()(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) const':
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:84:20: error: 'collate' in namespace 'std' does not name a template type
>       typedef std::collate<_CharT> __collate_type;
>                    ^~~~~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:85:13: error: '__collate_type' does not name a type; did you mean '__failure_type'?
>       const __collate_type& __collate = use_facet<__collate_type>(*this);
>             ^~~~~~~~~~~~~~
>             __failure_type
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:86:15: error: '__collate' was not declared in this scope
>       return (__collate.compare(__s1.data(), __s1.data() + __s1.length(),
>               ^~~~~~~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:86:15: note: suggested alternative: 'collate'
>       return (__collate.compare(__s1.data(), __s1.data() + __s1.length(),
>               ^~~~~~~~~
>               collate
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc: At global scope:
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:149:12: error: expected initializer before '<' token
>     collate<_CharT>::_M_compare(const _CharT*, const _CharT*) const throw ()
>            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:155:12: error: expected initializer before '<' token
>     collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const throw ()
>            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:160:12: error: expected initializer before '<' token
>     collate<_CharT>::
>            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:198:14: error: expected nested-name-specifier before 'collate'
>     typename collate<_CharT>::string_type
>              ^~~~~~~
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:198:21: error: expected initializer before '<' token
>     typename collate<_CharT>::string_type
>                     ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:255:12: error: expected initializer before '<' token
>     collate<_CharT>::
>            ^
>c:\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\8.4.0\bits\locale_classes.tcc:270:25: error: 'collate' is not a class template
>   extern template class collate<char>;
>                         ^~~~~~~
>
>
>[...] and more

Could someone help me to understand the error?

Looks like a corrupted toolchain to me. Please follow Unable to resolve configuration with compiler path ERROR and generating random files in projects - #10 by slopsjon to make sure you have the release version of the C/C++ extension by microsoft so that it does not corrupt your files. Then, delete every folder in <home folder>/.platformio/packages, <home folder>/.platformio/.cache and <home folder>/.platformio/platforms and rebuild the project. It will take a while for PlatformIO to redownload its packages.