Skip to content

C++ 20 support issues #777

@iontodirel

Description

@iontodirel

I was able to successfully use C++ 20, by modifying the teensy\hardware\avr\1.59.0\boards.txt.

However, I noticed I am getting some linker errors about definitions not found for few C functions.

I fixed this using the following:

#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>

void _exit(int status) { while (1) {} }
int _close(int file) { return -1; }
int _fstat(int file, struct stat *st) { st->st_mode = S_IFCHR; return 0; }
int _isatty(int file) { return 1; }
int _lseek(int file, int ptr, int dir) { return 0; }
int _read(int file, char *ptr, int len) { return 0; }
int _write(int file, char *ptr, int len) { return len; }
int _kill(int pid, int sig) { return -1; }
int _getpid(void) { return 1; }
int _sbrk(int incr) { return -1; }

Not sure why these functions are needed, or what are they referenced by, but this was the biggest issue for me when targeting C++20.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions