[Solved] "#include <M5Core2.h>" doesn't compile

  • My code has the following with empty setup and loop:

    #include <M5Core2.h>

    When I verify, it terminates with this:

    c:\users\xxxxx xxxxx\appdata\local\arduino15\packages\m5stack\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits\allocator.h:46:10: fatal error: bits/c++allocator.h: No such file or directory

    The file does exist in that location. File doesn't exist in this location, but exists in other directories.

    I'm compiling this on a Core 2, using this guide:


    So, what am I doing wrong?

  • Hi!
    I verify this simple code no problem.
    #include <M5Core2.h>
    void setup() {
    void loop() {
    Is this what you were talking about?

  • Hi, thanks for the reply.

    While writing my reply, I realised I misread the error. Arduino IDE cannot find "bits/c++allocator.h" which indeed doesn't exist in this directory. It exists in multiple different directories, though.

    I coped "c++allocator.h" into the path stated in my original post, and it got over this error. But, it's now missing another file.

    I could copy all these missing files (assuming there's more), but something seems to be wrong here.

  • @rh1972 said in "#include <M5Core2.h>" doesn't compile:


    My recent install of Arduino V2.0.3 doesn't have c++allocator.h installed and I could not find it anywhere in my computer.

    So, yes! I agree there must be something else wrong.
    Are you using Arduino V2.0.3?

  • Yeah, I'm using v2.0.3
    I installed the "M5Stack" boards, and then the "M5Core2" libraries, including dependencies. I've tried different versions of the boards.

    I'm I missing something obvious?

  • Well, it's working.

    The path to my Windows profile has a space in it. I created a local account without a space, and my empty program compiled with no issues. Don't know if that's the reason. Very strange.

    Makes me want to reinstall Ubuntu, or something.

    Thanks for the replies, Terry.